我創建了一個服務器列表,當我回顯服務器時,我希望hr標籤和IP位於div的底部,我該怎麼做?CSS3垂直對齊
繼承人我的代碼:
<div id='serverList'>
<div id='serverRank'>
<b>Rank</b><hr /><span>1</span>
</div>
<div id='serverInfo'>
<a href='?p=view&s=".$row['id']."'>".htmlentities($row['server_name'])."</a>
<hr />
".htmlentities(substr($row['server_description'],0,250))."
<div id='serverListBottom' valign='bottom'>
<hr />
<span id='frontInput'>IP: ".$row['server_ip']."</span></div>
</div>
我的CSS代碼:
#serverList {
height:auto;
width:550px;
-webkit-box-shadow: 7px 7px 20px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 7px 7px 20px rgba(50, 50, 50, 0.75);
box-shadow: 7px 7px 20px rgba(50, 50, 50, 0.75);
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
margin-left:10%;
margin-right:auto;
text-decoration:none;
text-align:left;
min-height:100px;
height:170px;
margin-bottom:40px;
padding:0px;
}
#serverList a {
font-size:20px;
font-weight:bold;
text-decoration:none;
color:#222222;
}
#serverList a:hover {
font-size:20px;
font-weight:bold;
text-decoration:none;
color:#444444;
}
#serverRank{
border:solid 3px #F2F200;
padding:5px;
padding-left:10px;
float:left;
width:50px;
text-align:center;
-moz-border-radius-bottom-right: 20px;
-webkit-border-bottom-right-radius: 20px;
border-bottom-right-radius: 20px;
-moz-border-radius-top-left: 20px;
-webkit-border-top-left-radius: 20px;
border-top-left-radius: 20px;
-webkit-box-shadow: 4px 4px 10px rgba(240, 240, 50, 0.5);
-moz-box-shadow: 4px 4px 10px rgba(240, 240, 50, 0.5);
box-shadow: 4px 4px 10px rgba(240, 240, 50, 0.5);
}
#serverListBottom {
margin-bottom:0px;
}
#serverInfo {
float:right;
width:450px;
}
#frontInput {
color: rgb(0, 0, 0);
font-size: 14px;
padding: 2px;
text-shadow: 0px -1px 0px rgba(30, 30, 30, 0.8);
-webkit-border-radius-left: 5px;
-moz-border-radius-left: 5px;
border-radius-left: 5px;
background: rgb(219, 219, 219);
background: -moz-linear-gradient(90deg, rgb(219, 219, 219) 30%, rgb(240, 240, 240) 50%);
background: -webkit-linear-gradient(90deg, rgb(219, 219, 219) 30%, rgb(240, 240, 240) 50%);
background: -o-linear-gradient(90deg, rgb(219, 219, 219) 30%, rgb(240, 240, 240) 50%);
background: -ms-linear-gradient(90deg, rgb(219, 219, 219) 30%, rgb(240, 240, 240) 50%);
background: linear-gradient(0deg, rgb(219, 219, 219) 30%, rgb(240, 240, 240) 50%);
-webkit-box-shadow: -1px 1px 1px rgba(50, 50, 50, 0.75);
-moz-box-shadow: -1px 1px 1px rgba(50, 50, 50, 0.75);
box-shadow: -1px 1px 1px rgba(50, 50, 50, 0.75);
}
#frontInput:hover {
cursor:pointer;
}
你也許可以在你的頭上這是什麼樣子的樣子,但我有什麼要在#serverListBottom上做些什麼才能使其位於#serverList div的底部?
你能不能做'的位置是:絕對的;'然後'底部:0 ;'? – Albzi
不使用hr,但使用您繪製線條的容器。 –
查看答案,但簡短回答是''position' relative' to your'#serverlist'和'position:absolute; bottom:0;'to'#frominput'。 – Albzi