Adjust height of div only if child element has class X

376
June 15, 2017, at 08:16 AM
.embed {
   height: 100px
}

How can I adjust the height of the div container, only when the iframe class is my-iframe

<div class="embed">
   <iframe class="my-iframe">
</div>

I do NOT want it to adjust the height in the following case:

<div class="embed">
   <iframe class="some-other-iframe">
</div>

Is it possible to do so in SASS or CSS?

Answer 1

When you increase the height of the iframe the parent div will also increase as long as the isn't already a height specified for the div. You can increase the height of the iframe doing this

iframe[class*="my-iframe"]{
   height: 500px /*or whatever height you want*/
}

This will target only the iframe that contains the class "my-iframe".

Rent Charter Buses Company
READ ALSO
Text wrapping around icon with spans inside of h3 tag

Text wrapping around icon with spans inside of h3 tag

I am trying to get my text to align so that the text does not wrap around this iconI am having trouble because my icon and my text are inside of an h3 tag and an anchor and I am using spans

234
SVG animation is not working on IE11

SVG animation is not working on IE11

I have a really simple loading animation that works perfectly on Firefox and Chrome, but in IE11 it's not showing the SVG figure

1623
Bootstrap- Page layout Issue in using Bootstrap columns

Bootstrap- Page layout Issue in using Bootstrap columns

I use Bootstrap columns for styling my pageI have 4 main div in my row and I expect them to display in a row but they aren't and also a scroll-bar are inserted in the bottom of the page

328
How can i center this second nav bar in marerializecss?

How can i center this second nav bar in marerializecss?

i have a navigation bar i made using MaterializeCSS and i was wondering how to center the bottom oneHere is my code:

270