Is there a way to disable the auto-size in the Moodle H5P plugin?

21cccs's picture


I wanted to know if there was a way to Is there a way to disable the auto-sizing that occurs directly in the Moodle H5P plugin?

We typically use the H5P plugin in Moodle to create an activity and then we embed that activity somewhere else (like in a lesson). Then we remove the resize script to keep the activity iframe as the exact dimensions we wish it to be at.

However, we have a teachers that created an a few H5P drag and drop activities and she wants her students to go directly into the H5P Moodle activity and complete it for credit. The problem is, since they're going right into the activity directly, we cannot remove that script that would appear when we use the embed code. 

This causes the activity to stretch across the page on wider monitors making it very difficult to do the activity -- students need to adjust their browser window for each activity:

View from a desktop wide screen monitor: 


View of the actual size set in the H5P sessions during content creation:


Anyway to get the H5P activity to respect the width set in the H5P activity settings? Maybe a setting I have overlooked? thanks,


icc's picture

You could try setting a max-width on the outer element using CSS, as this appear to be the main issue.

Beatriz Rojo's picture

Hi, I have the same problem, the activity becomes unpracticable. @icc: could you specify what your solution is? I don't have access to the source code of my Moodle instance because it's from a third-party Moodle partner. Can a user with administrator rights apply the changes you mean?



BV52's picture

Hi Beatriz,

What icc meant was to use a PHP hook, to add your own CSS-file to the content type. Please visit the Visual Changes page for more details. I think you can with admin rights but I could be mistaken.



21cccs's picture

Since I'm on a hosted Moodle, my work around is to Stealth Mode the actual H5P activity and then embed the H5P iFrame (without the resize script) into a Page resource with specified dimensions.