First of all have in mind that your HTML is not valid! (like h3
can't be in h6
, li
must be inside ul
, if using external css, don't use inline too...)
If your text is only single line ever, apply line-height
same as container:
li {
list-style: none;
}
p {
margin: 0px
}
ul {
margin: 0px;
padding: 0px
}
.centerText {
line-height: 50px;
}
.text1 {
line-height: 100px;
font-size: 18px;
}
<li style="background:#263F73; border-style: dotted; border-width: 1px; height:100px;">
<div style="width:70%; float: left; ">
<h6 style="margin:0px;" class="text1">Text1</h6>
</div>
<ul style="float: right; height:100%; width: 30%;">
<li style=" height:50%; background:#ffffff;">
<p style=" margin: 0px;">
<p class="centerText">Text2</p>
</li>
<li style=" height:50%; background:#fff465;">
<p style=" margin: 0px;">
<p class="centerText">Text3</p>
</li>
</ul>
</li>
If you have multiline text, than use display: table
and display: table-cell
li {
list-style: none;
}
p {
margin: 0px
}
ul {
margin: 0px;
padding: 0px
}
.table {
display: table;
}
.tcell {
display: table-cell;
vertical-align: middle;
}
<li style="background:#263F73; border-style: dotted; border-width: 1px; height:100px;">
<div style="width:70%; float: left; height: 100%;" class="table">
<div style="margin:0px;" class="tcell">Text1<br/>Multiple</div>
</div>
<ul style="float: right; height:100%; width: 30%;">
<li style=" height:50%; background:#ffffff; width: 100%" class="table">
<p style=" margin: 0px;" class="tcell">
Text2
</p>
</li>
<li style=" height:50%; background:#fff465; width: 100%" class="table">
<p style=" margin: 0px;" class="tcell">
Text3
</p>
</li>
</ul>
</li>
` this is SO bad! – Rahul Desai Nov 19 '14 at 12:18Text