背景div图像 - 重复问题
问题描述:
我目前正在使用我喜欢放置在我的标题部分背景中的横幅。我遇到的问题是图像重复出现。我尝试使用属性no-repeat
,结果我没有得到任何东西显示。该图像被设置为#header
div的背景。我如何让图像不重复出现?背景div图像 - 重复问题
CSS
<style>
#header {
height:165px;
border-top:15px solid #000;
background-image: url(http://webprolearner2346.zxq.net/css-test2/images/banner1.png);
}
</stle>
HTML
<div id="header">
<div class="search"><input type="text" class="search-input" name="search" value="Search" onclick="$(this).val('');" /><input type="submit" class="search-submit" /></div>
<div id="navigation">
<ul class="button-list">
<h2>MAIN TITLE PAGE</h2>
<li><a href="#" class="buttonNav" >Content 1</a></li>
<li><a href="#" class="buttonNav" >Content 2</a></li>
<li><a href="#" class="buttonNav" >Content 3</a></li>
<li><a href="#" class="buttonNav" >Content 4</a></li>
<li><a href="#" class="buttonNav" >Content 5</a></li>
</ul>
</div>
</div>
答
#header {
height:165px;
border-top:15px solid #000;
background-image: url('http://webprolearner2346.zxq.net/css-test2/images/banner1.png');
background-repeat: no-repeat;
}
证明:http://awesomescreenshot.com/029cplk1d
,但你不妨做这样说:
background: url('http://webprolearner2346.zxq.net/css-test2/images/banner1.png') no-repeat;
答
u能打通这个您想要的结果: -
#header {
background-image: url("http://webprolearner2346.zxq.net/css-test2/images/banner1.png");
background-repeat: no-repeat;
border-top: 15px solid #000000;
height: 165px;
}
答
你也可以试试这个;
<style>
#header {
height:165px;
border-top:15px solid #000;
background:url(http://webprolearner2346.zxq.net/css-test2/images/banner1.png) no-repeat;
}
</style>
“无重复”在哪里? – ChiefTwoPencils 2012-08-09 10:14:37
'background-repeat:no-repeat;' – krish 2012-08-09 10:14:53