.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?
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".
Related
With scss / bootstrap 4.5 html I set max width for for images with class
max-width: 250px;
height: auto;
It works ok for big images, but if image is small then it is ugly...
But if image is small in witdh, if there is a way not to make width bigger its original size?
Thanks!
Wrap the img tag in a div tag and set the max-width for the div tag to be 250px and the max-width for the img tag to be 100%.
<div style="max-width: 250px;">
<img style="max-width: 100%" src="yourImage.jpg">
</div>
I've tried to find a solution to this seemingly simple issue, but with no luck. I'm using AngularJS and Angular Material.
index.html
<div class="parent" layout="column" layout-fill ng-view>
</div>
Example HTML template:
<div class="child" layout="column" layout-fill>
<div flex="20">
Some content
</div>
<div flex>
Some more content
</div>
</div>
(There's nothing in the parent and child CSS classes, used just for name reference here)
In case the content is shorter than the screen height, I want both parent and child divs to be full height and the content divs to expand according to the flex properties. The layout-fill directive from Angular Material adds the 100% height, so this is currently working.
In case the content is longer than what can be displayed withing the screen height, I would like the child div to be scrollable.
My idea was to use media queries to append class properties to the child div in case height is below say 400px.
#media screen and (max-height: 400px){
.child{
height: 400px;
overflow-y: scroll;
}
}
Unfortunately this doesn't work. The child height is the same as the parent (screen height). When inspecting the element (Chrome) it says that css height is 400px, but the computed height is not.
I really don't understand that.
JSFiddle
Any ideas?
I would change the settings in the media query to
child {
min-height: 400px;
overflow-y: visible;
}
That forces it to be as high as its content and at least 400px, which will scroll in the body.
https://jsfiddle.net/zy0o7jn6/1/
http://makememodern.com/portfolio/
You will see that I have embedded a website onto the page and that it is aligned to the right side of the page. I would like it to be centered.
<div style="text-align:center">
<iframe style="-webkit-transform: scale(0.7);" src="http://www.stokeswilliams.com" width="100%" height="700px"></iframe>
</div>
You are setting the width of the iframe as 1100px. The div that's wrapping it has a dynamic width.
To solve it, you can set the width of the iframe to match the width of its parent container, by doing this:
iframe {
width: 100%;
}
I want to have a header with 100% width,
in some cases there is a horizontal scrollbar and that
causes the div to cover the visible area and not the whole
parent element.
.cont {
width: 100%;
}
http://jsfiddle.net/BhRdV/1/
There are certain cases, where even if you don't set width to DIV, it will still scale 100%.
Also, please be clear with ur question.
<div style="width:1200px;">
<div style="width:100%;">Tadda</div>
<div>Tadda 2</div>
</div>
I have a simple page with a single div. Inside that div I have an image with dimensions [h:58px, w:173px].
<body>
<div id="main_header">
<img src="logo.gif" style="padding: 0; margin: 0;">
</div>
</body>
It is not wrapped in any other tags. However, Chrome calculates the height of the container div as 63px. There is no associated css with the #main_header. html and body both have margin and padding set to 0.
Can anyone explain why the div's height is coming out to 63 and not 58?
It's because of the parent's line-height. Either set the line-height (or font-size) of the parent to zero, or set the image to display: block.