[前端]HTML文本格式化

字体的格式:(加粗,重点,斜体) 

<html>
<head>
    <meta charset="UTF-8">
    <title>This is a title</title>
</head>
<body>
<b>加粗</b>
<strong>加重语气</strong>
<em>着重文字</em>
<i>斜体字</i>
<small>小号字</small>
<sub>上标字</sub>
H<sub>2</sub>O
H<sup>2</sup>
</body>
</html>

显示:

 格式化:

一个有趣的保留原有格式的标签:

<pre>标签

<html>
<head>
    <meta charset="UTF-8">
    <title>This is a title</title>
</head>
<body>
<pre>保留空格和换行</pre>
<pre>for(int i=0;i<100;i++){
     System.out.println(i);
     }</pre>
</body>
</html>

显示:

计算机输出标签:

<html>
<head>
    <meta charset="UTF-8">
    <title>This is a title</title>
</head>
<body>
<code>计算机代码</code>
<br/>
<kbd>Keyboard code----键盘码</kbd>
<br/>
<tt>Teletype text-------打字机代码样本</tt>
<br/>
<samp>Sample text-------计算机代码样本</samp>
<br/>
<var>Computer variable------定义变量</var>
<p>
<b>注释</b>
</p>
</body>
</html>

 显示:

缩写和首字母缩写:

<html>
<head>
    <meta charset="UTF-8">
    <title>This is a title</title>
</head>
<body>
<abbr title="etcetera">etc.</abbr>
<br/>
<acronym title="World wide web">WWW</acronym>
</body>
</html>

将鼠标移到你缩略好的字母上显示全称:

块引用:

 

<html>
<head>
    <meta charset="UTF-8">
    <title>This is a title</title>
</head>
<body>
<blockquote>长引用
    1.  失业  unemployment = layoffs= job losses
    2.  简历  resume – hand in
    3.  人才人事  personnel = talent =human resources
    4.  职位  position = post =opening
    5.  福利计划  benefitspackage
    6.  创新  innovation =creativity
    7.  顾问  consultant
    8.  破产  bankrupt = shut down
    9.  剧降  decline = drop = fall
    10. 恶化  deteriorate = decline= get worse
    11. 市议会  city council
</blockquote>
<q>短引用
    1.  失业  unemployment = layoffs= job losses
    2.  简历  resume – hand in
    3.  人才人事  personnel = talent =human resources
    4.  职位  position = post =opening
    5.  福利计划  benefitspackage
    6.  创新  innovation =creativity
    7.  顾问  consultant
    8.  破产  bankrupt = shut down
    9.  剧降  decline = drop = fall
    10. 恶化  deteriorate = decline= get worse
    11. 市议会  city council
</q>
<p><b>长引用和短引用相比:长引用增加外边距</b></p>
</body>
</html>

显示:

删除字和插入字:

 

<html>
<head>
    <meta charset="UTF-8">
    <title>This is a title</title>
</head>
<body>
<p>买<del>13</del><ins>31</ins>瓶果啤回来。</p>
<b>其中<em>del</em>标签是删除字,而<em>ins</em>标签是插入字</b>
</body>
</html>

显示:

总结:

  • <b>    定义粗体文本。
  • <big>    定义大号字。
  • <em>    定义着重文字。
  • <i>    定义斜体字。
  • <small>    定义小号字。
  • <strong>    定义加重语气。
  • <sub>    定义下标字。
  • <sup>    定义上标字。
  • <ins>    定义插入字。
  • <del>    定义删除字。
  • <s>    不赞成使用。使用 <del> 代替。
  • <strike>    不赞成使用。使用 <del> 代替。
  • <u>    不赞成使用。使用样式(style)代替。
  • “计算机输出”标签
  • 标签    描述
  • <code>    定义计算机代码。
  • <kbd>    定义键盘码。
  • <samp>    定义计算机代码样本。
  • <tt>    定义打字机代码。
  • <var>    定义变量。
  • <pre>    定义预格式文本。
  • <listing>    不赞成使用。使用 <pre> 代替。
  • <plaintext>    不赞成使用。使用 <pre> 代替。
  • <xmp>    不赞成使用。使用 <pre> 代替。
  • 引用、引用和术语定义
  • 标签    描述
  • <abbr>    定义缩写。
  • <acronym>    定义首字母缩写。
  • <address>    定义地址。
  • <bdo>    定义文字方向。
  • <blockquote>    定义长的引用。
  • <q>    定义短的引用语。
  • <cite>    定义引用、引证。
  • <dfn>    定义一个定义项目。 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值