Trying to make the choice_result_text
vertically align in the middle. The span
successfully vertically aligns in the middle but not the p
. Any idea? Code:
.poll_results .choice_result {
margin-bottom: 3px;
height: 42px;
width: 100%;
}
.poll_results .choice_result p.choice_result_text {
float: left;
height: 39px;
background-image: linear-gradient(#4d4d4d, #262626);
position: relative;
top: 50%;
transform: translateY(-50%);
width: 30%;
color: #fff;
font-size: 15px;
border-radius: 2px 0 0 2px;
text-align: center;
border: 1px solid #333;
}
.choice_result_middle {
float: left;
height: 39px;
background-image: linear-gradient(#3366cc, #1f3d7a);
position: relative;
top: 50%;
transform: translateY(-50%);
min-width: 30%;
color: #fff;
font-size: 15px;
border-radius: 0 2px 2px 0;
text-align: left;
border: 1px solid #333;
margin-right: 7px;
border-left: none;
}
.poll_results .choice_result span {
float: left;
position: relative;
top: 50%;
transform: translateY(-50%);
}
<div class="poll_results">
<div class="choice_result" data-choice_percent="10">
<p class="choice_result_text">Yes</p>
<p class="choice_result_middle"></p>
<span>10%</span>
</div>
<div class="choice_result" data-choice_percent="35">
<p class="choice_result_text">No</p>
<p class="choice_result_middle"></p>
<span>35%</span>
</div>
<div class="choice_result" data-choice_percent="54">
<p class="choice_result_text">Yet to see</p>
<p class="choice_result_middle"></p>
<span>54%</span>
</div>
<p class="total_votes">Total Votes: 0</p>
</div>