Jump to content

css property for picture help


dsp77

Recommended Posts

the first advice is separate concerns, Use an external stylesheet. makes your code less sloppy, and it's easier to maintain, faster and less ugly.

second, always use an alt=" " attribute on images.

third, don't change the size of the image in html, use the size that is suitable otherwise you load a larger image than needed and that's a waste.

fourth use indentation.

 

make an external stylesheet and do this

css

div.my-image{ /*target the div element with the class of my-image */
   width:500px;
   overflow:hidden; /* cut off the image at 500px width */
   /* you can set a height for the image */
}

 

in your html

<div class="my-image">
   <a href="#"><img alt=" "src="images/pic1.jpg"></a>
</div>

 

Hope this helps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.