I am faciing an issue with the iframe size. So currently, i have an iframe in which there is a chatbot button, I have integrated this chatbot using botpress with my own website. now the problem is due this iframe at the bottom right corner, if I increase the size of chatbot button, it getscropped off due to the limited size of iframe. so how to make its sie larger, I have its class name, and seeing in the browser console , I need some css code to modify the size. I tried but doesnot work with css
1 Answers
You should be able to modify the iframe element with CSS styling specifically with the height
and width
properties:
<iframe style="width: 100%; height: 710px;" ...>
</iframe>
The second alternative, you could attempt to use the iframe attributes of width
and height
:
<iframe width="100%" height="100%" ...>
</iframe>
You mentioned it does not seem to work from CSS, this might be due to it inheriting size from a parent element, but that's speculation since you did not post a code reference. If that is the case, you could use the !important
keyword to force the style sizing for the iframe:
<iframe style="width: 100% !important; height: 710px !important;" ...>
</iframe>
The above is inline styling, if you wanted to get this to work with an iframe CSS class selector:
.myIframeClass {
height: 100%;
width: 100%;
}
If you are in need of overriding inherited sizing then using the !important
keyword can be used here as well within your CSS class selector styling:
.myIframeClass {
height: 100% !important;
width: 100% !important;
}
Take a look at this reference, it has some useful information on working with iframes.

- 11
- 3
-
Yes, I did try all of this, but it looks like when the iframe is injected from external application, it is not taking my style. this is the code for iframe which is coming from iinject.css file .bp-widget-widget { bottom: 24px; height: 76px!important; left: auto; right: 36px; top: auto; width: 76px!important; }. I am embedding it in react application. when I load the app then in my public.html file i can see the iframe id and class – Jayanta Basumatary May 21 '23 at 15:20
-
@JayantaBasumatary I recommend revising your original question and I'll update my response. There is an extra step to import CSS if it is a React application which may be causing your changes not to take effect. Also, please state what you have tried with an example or piece of the work to understand the situation better. – Matt Franca May 24 '23 at 01:12