Search code examples
htmlcssimage-resizing

Why is my image not resizing when other attributes are working fine?


I have been trying to resize this image in the following code. I have tried px, em, % and leaving the unit type blank but it will not resize. I have tried both width and height but neither make it change. The other attributes in the CSS are working fine: margin, position etc. Why won't the image resize?

Thank you so much for taking the time to read this and for your suggestion.

Code below

The HTML

    <div id='fixed-button'>

        <a href='main-home-timeline.html'>
          <img src='images/im-lost-clock.png'>
        </a>

        </div>

The CSS

    #fixed-button {
  position: fixed;
  width: 10;
  padding: 0;
  margin-top: 120px;
  margin-left: 600px;
}

Solution

  • You have to put width and/or height attributes for the img element, i.e. either you define a class for the img and then put width: 10px in it, or use the selector #fixed-button a img

    #fixed-button a img {
        width: 10px;
    }