Does anyone know why there is a difference between text-align: center and , text-align:-webkit-center ? For example if you have :
<section> <h1>Title<h1> <div class="image"></div> </section>
// CSS with text-align: center;
section{ text-align: center; }
This will center just the text
// CSS with text-align: -webkit-center
section{ text-align: -webkit-center; }
This will center the text and the image.
Same goes for text-align: -moz-center;
More answers about "What is the difference between align and text-align?" text-align - aligns text within the element to which this property is specified. align="center" aligns the element itself, if possible. For example, pictures, tables, frames, and so on.
The left-aligned text results in much better content readability, so all books, articles & newspapers are written this way. The left-aligned text helps to avoid unnecessary eye jumps, making the whole copy much easier to follow.
Centered text is best used for headlines and short lines of text. Users can read them with ease because the lines are short, scannable and don't need repeated eye movements. They can also give your layout a balanced look with its symmetrical format.
Text alignment is a paragraph formatting attribute that determines the appearance of the text in a whole paragraph. For example, in a paragraph that is left-aligned (the most common alignment), text is aligned with the left margin. In a paragraph that is justified, text is aligned with both margins.
From the Mozilla Developer Network:
Both WebKit and Gecko support a prefixed version of left, center, and right, that applies not only to inline content but also to block elements. This is used to implement the legacy
align
attributes ontable
elements and<center>
. Do not use these on production Web sites.— MDN's documentation on
text-align
.
The text-align CSS property describes how inline content like text is aligned in its parent block element. text-align does not control the alignment of block elements, only their inline content.
text-align: -moz-center; text-align: -webkit-center;
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