html中的常用格式

1加粗文字 -<strong>或<b>:

···<p>This is <strong>bold</strong> text.</p>

<!-- 或 -->

···<p>This is <b>bold</b> text.</p>

2斜体文字 -<em>或<i>:

···<p>This is <em>italic</em> text.</p>

<!-- 或 -->

<p>This is <i>italic</i> text.</p>

3下划线文字 -<u>:

···<p>This is <u>underlined</u> text.</p>

4删除线文字 -<s>或<del>:

···<p>This is <s>strikethrough</s> text.</p>

<!-- 或 -->

<p>This is <del>strikethrough</del> text.</p>

5上标和下标 -<sup>和<sub>

···<p>This is <sup>superscript</sup> text.</p>

<p>This is <sub>subscript</sub> text.</p>

6左对齐:将文本左对齐,这是默认值。

```.text-left {

    text-align: left;

}

7居中对齐:将文本水平居中对齐

```.text-center {

    text-align: center;

}

8右对齐:将文本右对齐

```.text-right {

    text-align: right;

}

9两端对齐:将文本两端对齐,使文本两侧边缘对齐。

···.text-justify {

    text-align: justify;

}

这些是一些基本的文本对齐样式。你可以将上述CSS样式应用到HTML元素,例如段落 <p>、标题 <h1> 等,以控制文本的对齐方式。以下是一个示例:

···<!DOCTYPE html>

<html>

<head>

    <style>

        .text-center {

            text-align: center;

        }

    </style>

</head>

<body>

    <p class="text-center">这是居中对齐的文本。</p>

</body>

</html>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容