我正在为我学校的一个俱乐部开发前端,我在将两个内联元素放在一起时遇到了问题。我已经被困在这几个晚上了,这真的让我很沮丧。我已经尝试了从边距、定位、内联块的所有内容,所有这些似乎都给了我一个或另一个问题。现在我已经束手无策了,所以我转向这里。元素应该在元素之上。这两个元素都在播放器中,假设在图像旁边。我将包含下载我的代码的链接,一旦你在浏览器中看到我的页面,我就会很明显地遇到问题。感谢你给与我的帮助。
https://dl.dropbox.com/u/21141217/HvZ.zip
编辑:我在这里遇到问题
<div id="recentTags">
<h4>RECENT TAGS</h4>
<div class="tag">
<div class="player">
<a href="">Chris Stephenson</a>
<h6>Legends</h6>
</div>
<img src="tag.png" alt />
<div class="player">
<a href="">Eric Tadt</a>
<h6>butt pirates</h6>
</div>
</div>
<div class="tag">
<div class="player">
<a href="">Zack Baer</a>
<h6>Little Bears</h6>
</div>
<img src="tag.png" alt />
<div class="player">
<a href="">Humble Trumble</a>
<h6>Glorious pres</h6>
</div>
</div>
</div>
相关CSS:
#recentTags{
width: 292px;
padding: 4px;
height: 236px;
/*My attempt at trying to recreate the color gradient. Gabe fix it*/
/*I used http://www.colorzilla.com/gradient-editor/ or you can just google css gradient generator*/
background: #5e5e5e; /* Old browsers */
background: -moz-linear-gradient(top, #5e5e5e 0%, #000000 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#5e5e5e), color-stop(100%,#000000)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #5e5e5e 0%,#000000 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #5e5e5e 0%,#000000 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #5e5e5e 0%,#000000 100%); /* IE10+ */
background: linear-gradient(to bottom, #5e5e5e 0%,#000000 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5e5e5e', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}
#recentTags h4{
color: #D23000;
background-color: grey;
padding-left: 8px;
/*Color gradient*/
background: #2d2d2d;
background: -moz-linear-gradient(left, #2d2d2d 0%, #4c4c4c 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#2d2d2d), color-stop(100%,#4c4c4c));
background: -webkit-linear-gradient(left, #2d2d2d 0%,#4c4c4c 100%);
background: -o-linear-gradient(left, #2d2d2d 0%,#4c4c4c 100%);
background: -ms-linear-gradient(left, #2d2d2d 0%,#4c4c4c 100%);
background: linear-gradient(to right, #2d2d2d 0%,#4c4c4c 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2d2d2d', endColorstr='#4c4c4c',GradientType=1 );
}
.tag{
width: 280px;
height: 31px;
margin-top: 5px;
padding:3px;
border: 0px solid #829485;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
/*Gradient*/
background: rgb(30,87,153);
background: -moz-linear-gradient(top, rgba(30,87,153,1) 0%, rgba(255,255,255,1) 0%, rgba(53,53,53,1) 2%, rgba(73,73,73,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(30,87,153,1)), color-stop(0%,rgba(255,255,255,1)), color-stop(2%,rgba(53,53,53,1)), color-stop(100%,rgba(73,73,73,1)));
background: -webkit-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(255,255,255,1) 0%,rgba(53,53,53,1) 2%,rgba(73,73,73,1) 100%);
background: -o-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(255,255,255,1) 0%,rgba(53,53,53,1) 2%,rgba(73,73,73,1) 100%);
background: -ms-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(255,255,255,1) 0%,rgba(53,53,53,1) 2%,rgba(73,73,73,1) 100%);
background: linear-gradient(to bottom, rgba(30,87,153,1) 0%,rgba(255,255,255,1) 0%,rgba(53,53,53,1) 2%,rgba(73,73,73,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#494949',GradientType=0 );
}
.tag a{
color: #D23000;
display: inline-block;
text-decoration: none;
font-size: 13px;
font-weight: bold;
position: relative;
bottom: 14px;
}
.player{
width:110px;
display: inline;
}
.tag img{position: relative;}
.tag h6{
display: inline;
}
dabblet 链接:http ://result.dabblet.com/gist/4007549/381ecd27edf3c72fbde28575ca9cd2e50e2c2a52
编辑:我想我选择了错误的单词选择,我想将元素放在元素之上。所以最终结果将如下所示:
克里斯斯蒂芬森传奇