We may possibly stop using the Bootstrap framework, so I want to know if replacing class="text-center"
with vanilla CSS will change anything. Is there any difference in behavior between
<!--Bootstrap files already included-->
<header>
<p class="text-center">Some text</p>
</header>
and
<header>
<p>Some text</p>
</header>
...
/*Separate style.css file*/
header p {
text-align: center;
}
?
The OP's question seems to have been edited after it was first posted. It essentially asks: whether Bootstrap does anything extra to elements with the class .text-center
, in addition to text-align: center;
. I also had this doubt and the answer is no. I think this question can be better answered by just looking at Bootstrap's source code:
.text-center {
text-align: center !important; }
Apparently all that Bootstrap does is to apply one CSS rule: text-align: center !important;
to such an element. So yeah they can be considered equivalent.
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