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

The difference between text-align and align in css

零下一度
Release: 2017-06-19 16:44:40
Original
4140 people have browsed it

text-alignIntroduction:

Syntax:

text-align : left | right | center | justify
Copy after login

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; }
Copy after login

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>
Copy after login

text-align(text-align is an attribute of Css):

<p style="text-align:center">

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>
Copy after login

align is written directly as an attribute of p

<p style="text-align:center">
Copy after login

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!

Related labels:
Statement of this Website
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
Latest Issues
Unable to automatically align text
From 1970-01-01 08:00:00
0
0
0
I can't align my logo with the navigation bar
From 1970-01-01 08:00:00
0
0
0
Align text items to center
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template