Julie Van Olmen
Julie Van Olmen

Reputation: 11

Height and weight attributes being ignored by css

We just updates our sites design, but we just can't figure out why CSS is ignoring height and width?

For instance, the YouTube embedded videos don't stay at 625x352

<iframe width="625" height="352" src="https://www.youtube.com/embed/jPcfAqIyuI4" frameborder="0" allowfullscreen></iframe>

And the images with an original width of 155px and height of 250px don't transform to 155x180 as specified in the html.

<a href="http://my.jpg" target="_blank"><img src="http://thumbnail.jpg"  width="155" height="180" /></a>

Anybody has an idea how to fix this?

Upvotes: 0

Views: 238

Answers (2)

Julie Van Olmen
Julie Van Olmen

Reputation: 11

Hurray !! I found a solution to my problem.

instead of

width="625px" height="352px"

I rewrote the style

style="width:625px;height:352px;"

And it worked!

Upvotes: 1

Mehmet Eren Yener
Mehmet Eren Yener

Reputation: 2036

for player remove width 100%

iframe {
  /* width: 100%; */
  min-width: 0;
  max-width: 100%;
}

or you can add inline css "width: initial;" to iframe if you can not play with the stylesheet

<iframe width="625" height="352" width: initial;"> </iframe>

Upvotes: 1

Related Questions