为了制作如下的时间线,我创建了一个ul
带有背景图像的元素,并为每个li
元素赋予了背景颜色。
源代码如下:
<style>
body{
//background: url(http://ut-images.s3.amazonaws.com/wp-content/uploads/2010/02/The-Brightest-of-Stars.jpg)
}
ul {
background-image: url("http://i.imgur.com/AmIstws.gif");
background-position: 0 14px;
background-repeat: repeat-x;
height: 30px;
overflow: hidden;
position: relative;
}
li {
font-size: 16px;
height: 30px;
line-height: 28px;
text-align: center;
width: 100px;
list-style: none outside none;
float: left;
}
span {
background-color: white;
}
</style>
<ul>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
<li><span>20130307</span></li>
</ul>
但是,如果我设置body
不带solid background color
,则ul
背景图像将突破li
元素,如下所示。
源代码如下:
<style>
body{
background: url(http://ut-images.s3.amazonaws.com/wp-content/uploads/2010/02/The-Brightest-of-Stars.jpg)
}
ul {
background-image: url("http://i.imgur.com/AmIstws.gif");
background-position: 0 14px;
background-repeat: repeat-x;
height: 30px;
overflow: hidden;
position: relative;
}
li {
font-size: 16px;
height: 30px;
line-height: 28px;
text-align: center;
width: 100px;
list-style: none outside none;
float: left;
}
span {
background-color: transparent;
}
</style>
我想问是否有可能制作像下面这样的东西?
谢谢