Zaloguj | Zarejestruj | FAQ
Anonymous

CSS bg images will not appear unless text is in the div. Wh

+ Odpowiedz

Posty: 2 Strona 1 z 1


CSS bg images will not appear unless text is in the div. Wh

przez cjr » Pn lip 28, 2014 3:59 pm

The following CSS background images will not display live unless there is text inside the bg image. As well, header_bg.png does not appear as the correct pic. It appears solid black. The footer_bg.png image displays correctly. Where is my mistake?

<style type="text/css">

#header_bg {background-image:url(accentphotos/header_bg.png);
background-repeat:repeat-x;
height:auto;
margin-bottom: 450px;
}

#footer_bg {background-image:url(accentphotos/footer_bg.png);
background-repeat:repeat-x;
height:auto;
margin-top:75px;
}
</style>
</head>
<body>


<table width="900" border="0">
<tr>
<td colspan="3"> <div id="header_bg"> afadfadf</div> </td>
</tr>
<tr>
<td> dafd</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3"> <div id="footer_bg"> afdadf </div> </td>
Avatar użytkownika

cjr

  • Posty: 14
  • Dołączył(a): Pt cze 06, 2014 2:27 pm

Re: CSS bg images will not appear unless text is in the div.

przez XainPro » Cz lip 31, 2014 8:35 am

do not set

height:auto;

set the height of your divs same as your image height

ie is your image height is 250px then set it like

height:255px;
Avatar użytkownika

XainPro

  • Posty: 3933
  • Dołączył(a): Pt lut 17, 2012 8:10 pm


+ Odpowiedz

Strona 1 z 1