dsp77 Posted April 2, 2011 Share Posted April 2, 2011 Hello, what i try to accomplish is to force the bigger picture(726px) to go/hide under the div(500px) but display the first 500px. Any advise? <div style="width:500px;"><a href="#"><img width="726" height="199" src="images/pic1.jpg"></a></div> Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 2, 2011 Share Posted April 2, 2011 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! Quote Link to comment Share on other sites More sharing options...
dsp77 Posted April 3, 2011 Author Share Posted April 3, 2011 Thank you, i was using the overflow on the img. p.s i know about the external css etc i just posted fast:) thank you again Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 3, 2011 Share Posted April 3, 2011 no problemo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.