View Single Post
Old 01-04-2013, 03:01 PM   PM User | #4
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
This is because the width and height attributes of an img are (pixel) values, so "px" in the height attribute is also invalid.

The previous post confirms that you can set these values in CSS.

An alternative approach is to make the image the background to another element. However, stretching a background-image is only available from CSS3:

Code:
background-size: 100%; /* CSS3, or */

.style1 {
        background: url(images/bg.jpg) no-repeat center center fixed;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
        background-size: cover;
} /* IE 9+ */
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote