Click here to Skip to main content
16,020,622 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Hai
How to stretch background image for ie8,ie9,chrome and mozila ?
JavaScript
<head>
<title>TITLE HERE</title>
<link href="styles/all.css" rel="stylesheet" />
<!--[if lte IE 8]>
        <link href="styles/ie8.css" rel="stylesheet" />
<![endif]-->
</head>
<body style="margin: 0px; overflow: auto">
<form id="form1" runat="server">
<table  width="100%"  id ="tbllogin">----id is calling css styles
     <tr>
      <td style="width: 100%">
      </td>
     </tr>
  </table>
</form>
</body>


Actually i have two stylesheet all.css and ie8.css.
all.css for ie9,chrome and mozila.
ie8.css for ie8 only.
In my html code it will work ie8 but css not work for ie9,chrome and mozila.

in all.css having this code
CSS
#tbllogin
{    
    background-size: 100% 100%;
    background-image: url("images/bckgrd.png");
    background-repeat: repeat-y;
    background-attachment: inherit;
}


in ie8.css having this code
CSS
#tbllogin
{
    background-size: 100% 100%;
    background-repeat: repeat;
    background-image: url("images/bckgrd.png");
    background: no-repeat center center fixed;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader( src="images/bckgrd.png", sizingMethod="scale");
}

My need is how to call different stylesheet based on browser
if ie 8 i need to call ie8.css and other browsers need to call all.css

How to check ie8 or other browsers and need to call particular css ?
The above inside head tag ie8 correctly work but other browser not call the all.css style sheet.

Pls reply asap.

Regards
Aravind
Posted
v4
Comments
Aravindba 3-Oct-13 3:33am    
Hi Above code is working correctly,it will streach image for ie8 and other browsers also just i give background image for table ,and then it work for all browsers.
<table width="100%" id ="tbllogin">----id is calling css styles
<tr>
<td style="width: 100%;background-image: url('/KM/images/img_Header03.png');">
</td>
</tr>
</table>

CSS
#tbllogin
{    
    background-size: 100% 100%;
    background-image: url("images/bckgrd.png");
    background-repeat: repeat-y;
    background-attachment: inherit;
    -webkit-background-size: 100% 100%;
    -moz-background-size: 100% 100%;
    -o-background-size: 100% 100%;
    -ms-background-size: 100% 100%;
}
 
Share this answer
 
v3
hi,

you can use the css for background.
here is the css
CSS
background-size:cover
 
Share this answer
 
Comments
Aravindba 16-May-14 21:54pm    
this one support ie8,ie9,ie10,mozila and chrome ?pls give full code like width,height,repeat,attachment like
background:contain;
background:100% 100%;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900