登录 | 注册 | FAQ
Anonymous

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

+ 发表回复

2 篇帖子 分页: 1 / 1


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

cjr » 周一 7月 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>
头像

cjr

  • 帖子: 14
  • 注册: 周五 6月 06, 2014 2:27 pm

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

XainPro » 周四 7月 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;
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm


+ 发表回复

分页: 1 / 1