jcubic jcubic - 3 months ago 10
CSS Question

how to make div with one line of text and div with two the same height?

How can I make all boxes (box class) the same height so status is in the same line? The text inside boxes need to be vertically aligned. I need something like this (don't worry about the arrows):

enter image description here

I need to support IE10. I have html and css like this:



ul {
list-style: none;
padding: 0;
margin: 0;
}
ul li {
float: left;
}
.box {
white-space: pre;
text-align: center;
display: block;
border: 1px solid black;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
width: 200px;
padding: 10px 0;
}

<ul>
<li>
<span class="box">Get parent
folder owner</span>
<span class="status">PASSED</span>
</li>
<li>
<span class="box">Some text</span>
<span class="status">PASSED</span>
</li>
<li>
<span class="box">Some text</span>
<span class="status">RUNNING</span>
</li>
</ul>




Answer

Add three last properties:

.box {
    white-space: pre;
    text-align: center;
    display: block;
    border: 1px solid black;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    width: 200px;
    padding: 9px 0;
    /*add the lines below:*/
    display: table-cell;
    height: 70px;
    vertical-align: middle;
}
Comments