I want to center the speaker div, which is within the review div. i cannot seem to get it working. :(
HTML:
<div class="review">
<div class="speaker">
<p>SPEAKER DIV</p>
</div>
</div>
CSS:
.speaker{
align:center;
}
This doesn't work :/
Give it a width and margin:0 auto;
<div class="review">
<div class="speaker">
<p>SPEAKER DIV</p>
</div>
</div>
div.speaker{
background-color:red;
width:100px;
margin:0 auto;
}
See it in action!
There’s no such CSS property as align
.
When you say you want to “center” the speaker div, what exactly do you mean?
You can center-align its text like this:
.speaker {
text-align:center;
}
(See http://jsfiddle.net/pauldwaite/X7LN5/)
If, alternatively, you want the speaker div to only be as wide as its text, and be positioned in the center of the review div, then you’d need to use this:
.review {
text-align:center;
}
.speaker {
display:inline-block;
}
(See http://jsfiddle.net/wxha4/)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With