Image height and width not working?

124,135

Solution 1

You must write

<img src="theSource" style="width:30px;height:auto;" />

Inline styling will always take precedence over CSS styling. The width and height attributes are being overridden by your stylesheet, so you need to switch to this format.

Solution 2

You have a class on your CSS that is overwriting your width and height, the class reads as such:

.postItem img {
    height: auto;
    width: 450px;
}

Remove that and your width/height properties on the img tag should work.

Solution 3

http://www.markrafferty.com/wp-content/w3tc/min/7415c412.e68ae1.css

Line 11:

.postItem img {
    height: auto;
    width: 450px;
}

You can either edit your CSS, or you can listen to Mageek and use INLINE STYLING to override the CSS styling that's happening:

<img src="theSource" style="width:30px;" />

Avoid setting both width and height, as the image itself might not be scaled proportionally. But you can set the dimensions to whatever you want, as per Mageek's example.

Share:
124,135

Related videos on Youtube

Mark R
Author by

Mark R

Updated on January 31, 2022

Comments

  • Mark R
    Mark R about 2 years

    On this post I have set the image height and width and it's clearly seen in the HTML..

    [url removed]

    But the browser or Wordpress is causing the image to stay same size.

    I want it to be smaller?

Related