Home > Article > Web Front-end > Can't align be used in html5?
The align attribute cannot be used in html5. This attribute is no longer supported in html5; the align attribute mainly affects the horizontal alignment of the set elements. Setting the align attribute for tables, text, images and other elements has its performance The form is inconsistent, you can use the "text-align" attribute in CSS to replace the align attribute.
The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.
The align attribute is used in HTML tables, text, images and other elements. The align attribute mainly affects the horizontal alignment of the set elements, providing tables, text, and When the align attribute is set on elements such as images, their expressions are inconsistent.
align in html means "alignment", which is an attribute of the html tag. It is used to set the alignment of the content in the element. The syntax is
<element align="值">
The attribute values include left, right, center, etc., you can set the content to be aligned to the left, right or centered.
The align attribute specifies the horizontal alignment of content within a CSS alternative syntax: The example is as follows: Output result: (Learn Video sharing: css video tutorial, html video tutorial)<div style="text-align:center">
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph. This text has no alignment specified.</p>
<div style="text-align:center;border:1px solid red">
This is some text in a div element!
</div>
<p>This is a paragraph. This text has no alignment specified.</p>
</body>
</html>
The above is the detailed content of Can't align be used in html5?. For more information, please follow other related articles on the PHP Chinese website!