Home >Web Front-end >CSS Tutorial >The difference between text-align and align in css
Syntax:
text-align : left | right | center | justify
Parameters:
left: Left alignment
right : Right alignment
center : Center
justify : Justify both ends
Description:
Set or retrieve the alignment of text in object .
The corresponding script feature is textAlign. Please see other books I have written.
Example:
p { text-align : center; }
In HTML, what is the difference between text-align and align
1. align: Specifies the horizontal alignment of the content in the "p element".
2.text-align: Specifies the horizontal alignment of text "in the element".
The two attributes are used in different places, but have the same effect! align is relatively "narrow"; for example:
align(align is an attribute of p):
<p align="center"> This is some text!</p>
text-align(text-align is an attribute of Css):
76e874ca1f11dfe168ad4166a66a56a9
Both can center the content of p.
align: Specifies the horizontal alignment of the content in the p element.
text-align: Specifies the horizontal alignment of text "in the element".
The two attributes are used in different places!
<p align="center"> This is some text! </p>
align is written directly as an attribute of p
<p style="text-align:center">
text-align is an attribute of Css
In XHTML 1.0 Strict DTD, the p element is not supported align attribute.
Please use CSS instead.
The above is the detailed content of The difference between text-align and align in css. For more information, please follow other related articles on the PHP Chinese website!