我正在为我的学校中的一个俱乐部开发前端,并且在将两个内联元素放在彼此顶部时出现问题。我一直坚持这几个晚上,这真的让我很难过。我已经尝试了一切,从保证金,定位,内联块,所有这似乎给我一个问题或其他。现在我正处于智慧结局,所以我正在转向这里。元素假设在元素之上。这两个元素都位于图像旁边的播放器中。我将包括下载我的代码的链接,以及我遇到问题的位置,一旦您在浏览器中看到我的页面,就会很明显。感谢你给与我的帮助。CSS将内联元素放置在彼此的顶部在一个div中
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
编辑:我想我选用了错误的我想要放置上面的元素的话的选择要素。所以,最终的结果会是这样的:
克里斯·斯蒂芬森 传说如果我正确理解你的问题,你想要的球员姓名坐在上面的球员的队名,都坐在左侧,与
“元素应该高于元素”?哪些元素意味着高于其他元素?你能否给特定的元素一个明显的背景色,以便更容易地看到问题出在哪里?或者至少用'id'来识别它们。 –
所有元素都假设在每个“玩家”div类中的
元素之上。 –