Question

I'm creating a server list and when i'm echoing out the servers i want the hr tag and the IP to be at the bottom of the div, How do i do that?

Heres my code:

<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>

And my CSS code:

#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;
}

You might be able to look in your head what this looks like, But what do i have to do on the #serverListBottom in order to make it be on the bottom of the #serverList div?

Was it helpful?

Solution

http://codepen.io/anon/pen/nicCa

Here is a codepen.

I made the container position:relative and the text position:absolute; bottom:0;.

OTHER TIPS

Hmm, I think this can be achieved with some quick use of relative and absolute positioning. Add these styles to #serverInfo:

#serverInfo {
    height:100%;
    position:relative;
}

And replace the styles of #serverListBottom with this:

#serverListBottom {
    position:absolute;
    bottom:0;
    left:0;
    right:0;
    padding:0 0 3px;
}

You can change the bottom padding to adjust how far you want the IP from the bottom. (You can also get rid of the deprecated "valign" attribute on #serverListBottom.)

I hope that's what you were looking for. If not, feel free to say so, and I'll be happy to try to help you further.

exemple of a line aside a text:

 <p><span>IP</span></p>
 p {
      border:inset 1px ;
      border-left:0;
      border-right:0;
      height:0;
      margin:1.5em 0.5em;
      text-align:right;
    }
    p span {
      padding:0 20px;
      vertical-align:20px;
      line-height:0;
      background:white;
    }

Where <p> could be : #serverListBottom

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top