Home  >  Article  >  Web Front-end  >  The difference between text-align and align in css

The difference between text-align and align in css

零下一度
零下一度Original
2017-06-19 16:44:404014browse

text-alignIntroduction:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn