html5中不能使用align属性,该属性在html5中已经不再支持;align属性主要是影响设置元素的水平对齐方式,给表格、文字、及图像等元素设置align属性,其表现形式是不一致的,可以利用css中的“text-align”属性来代替align属性。
本教程操作环境:windows10系统、html5版本、dell g3电脑。
html5不能用alignhtml中表格、文字、图像等元素都有使用到align属性,align属性主要是影响设置元素的水平对齐方式,给表格、文字、及图像等元素设置align属性,其表现形式是不一致的。
html中align的意思是“对齐”,是html标签的一种属性,用于设置元素中内容的对齐方式,语法为
<element align="值">
属性值有left、right、center等,可设置内容向左、向右或居中等多种对齐方式。
html5中已不再支持 <div> align 属性,请使用 css 替代。
<div> 的 align 属性在 html 4.01 中已被废弃。 in html 4.01.
align 属性规定 <div> 元素中的内容的水平对齐方式。
css 代替语法:
<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>
输出结果:
(学习视频分享:css视频教程、html视频教程)
以上就是html5不能用align吗的详细内容。