HTML标签

HTML <center>标签(HTML5不支持)

HTML <center>标签(HTML5中不受支持)作用

HTML <center>是一个块级元素,其中包含块级和内联内容。在<center>元素之间编写的内容将显示在页面的中间。
<center>标签在HTML 4中已弃用,在HTML5中已过时。
注意:注意:现在不推荐使用<center>标签,因此可以使用CSS属性text-align:center;代替它。达到相同的结果。

语法

<center>Add Content Here....</center>
以下是有关<center>标签的一些规范
显示 内联
开始标签/结束标签 开始标签和结束标签
用法 文字

示例

使用<center>标签
<!DOCTYPE html>
<html>
<head>
<title>Center tag</title>
 </head>
 <body>
<h2>Example of center tag</h2>
    <center>This content is displayed in the middle of page, but try to use CSS property to align the content as this tag is deprecated now.</center>
  </body>
</html>
使用CSS
<!DOCTYPE html>
<html>
<head>
<title>Center tag</title>
<style >
h2{
text-align: center;}
</style>
 </head>
 <body>
      <h2>Example of center tag</h2>
      <p>This content is align centered using CSS property</p>
  </body>
</html>
输出:
 HTML中心标签

属性

HTML <center>标签在HTML中不包含任何特定的属性,但是它支持Global Attribute(直到<center>标签没有被完全删除)。

支持浏览器

标签 chrome浏览器 ie浏览器 firefox浏览器 opera浏览器 Safari浏览器
<center> 支持 支持 支持 支持 支持
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4