0
点赞
收藏
分享

微信扫一扫

Html之【文字格式标签】综合技巧大全(持续更新中...)


当前的 HTML/XHTML 标准一共提供了 9 种物理样式,包括粗体(bold)、斜体(italic)、等宽(monospaced)、下划线(underlined)、删除线(strikethrough)、放大(larger)、缩小(smaller)、上标(superscripted)和下标(subscripted)文本。这些标签是:

 <b>

 <big>

 <i>

 <s>

 <small>

 <strike>

 <sub>

 <sup>

 <tt>

一、标题<h></h>

<!--<h>标签是设置标题的,把重要的信息放在<h1>里面,搜索引擎会优先搜索-->
<h1>
中国一</h1>
<h2>
中国二</h2>
<h3>
中国三</h3>
<h4>
中国四</h4>
<h5>
中国五</h5>
<h6>
中国六</h6>


二、换行<br/>、不换行<nobr></nobr>和分段<p></p>

<!-- 换行和分段:-->   
<p>
这是第一段<br /> <!--换行-->
用到了换行标签<br />
请看效果<br />
很容易理解</p>
<p>
这是第二段</p> <!--分段,自动加换行-->
<p>
这是第三段</p>
<p>
<nobr> <!--防止换行-->
int i =0,j=10;
</nobr>
</p>


三、水平线标签<hr/>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<hr size="5" color="#FF0000" />
<!--定义了size(厚度)为5和color为红色的hr标签-->
<hr width="60" />
<!--width属性为60px-->
<hr width="60%" />
<!--width为60%-->
<hr size="10" />
<!--size为10px-->
<hr size="10%" />
<!--size为10%-->
<!--align属性,可取值分别为left、right和center-->
<hr width="20%" align="left" />
<hr width="20%" align="right" />
<hr width="20%" align="center" />
<hr color="#FF0000" />
<!--noshade属性,设置无阴影效果-->
<hr noshade="noshade" />
</body>
</html>


四、文本格式化标签

<!--常用文本格式标签-->
<center>博客园</center>居中显示
<b>Hello,World!</b>粗体,推荐使用<strong>标签。
<i>斜了吧</i>斜体。
<u>我是一个下划线标签</u>带下划线。
<em>强调,斜体</em>
<sub>2</sub>下标,如:H<sub>2</sub>O
<sup>2</sup>上标,如:10<sup>2</sup>

<!--设置字体大小可分为绝对字体大小和相对字体大小,绝对的通过<font>标签的size属性来设置, 而相对字体大小为默认字体的相对值-->
<!--绝对字体大小为size的值是1-7的某个数-->
<!--color(设置颜色) size(1-7)。-->
<!--face属性用于设置字体-->
<font></font>字体标签,<font color=“red“ size=“7” face=“隶书”>红色</font>


五、预格式化标签<pre>

<p>pre 标签显示某些特殊的希望原样展示的内容:</p>
<pre>
我是个好孩子,
我喜欢中 啊啊啊啊

这是一个预格式化标签

____
(. \
\ |
\ |___(\--/)
__/ ( . . )
"'._. '-.O.' 你好,我是一只小猫!
'-. \ "|\
'.,,/'.,,


(⊙_⊙)?你说什么呢????
</pre>

<p>pre 标签很适合显示计算机代码:</p>
<pre>
for i = 1 to 10
print i
next i
</pre>


六、<marquee></marquee>标签对告诉浏览器移动显示其中的文本和图像。

<div>
<!--marquee标签部分浏览器支持:IE、FF-->
<!--direction属性:指定内容的移动方向,可取值有left、right、up和down-->
<!--behavior属性:指定标签的行为,可取值有scroll、alternate和slide-->
<marquee direction="left" scrolldelay="100" behavior="alternate">
大家好,欢迎大家来到我的主页!......
</marquee>
</div>


七、其它的格式标签例子。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<!--<abbr>显示缩写:-->
<abbr title="British Broadcasting Corporation">
BBC</abbr><br />
<!-- <acronym>显示一个词组的缩写字头:-->
<acronym title="World Wide Web">www</acronym><br />
<!--<blockquote>定义了长文字的引用:-->
<blockquote>
<p>
Beyond two or three days ,the world's best forecasts are speculative ,and beyond
six or seven they are worthless.
</p>
<br />
<!-- <q>标签定义短引用:-->
<q>The q lable!!!</q>
</blockquote>

<!--<address>地址,签名,文档的作者信息等:-->
<address>
北京市海淀区中关村软件园 sys@qq.com
</address>
<!--<bdo>标签通过dir属性来定义文字显示的顺序:-->
<bdo dir="ltr">博客园</bdo><br /> <!--ltr:left to right,从左到右-->
<bdo dir="rtl">博客园</bdo><br /> <!--rtl:right to left,从右到左-->
</body>
</html>



八、


九、




举报

相关推荐

0 条评论