您的位置:首页 > Web前端 > HTML

基本HTML标签\文本格式化

2012-11-08 17:05 92 查看
一、HTML标签

标签很全的参考网站:

http://htmling.cn/html/indexm.html

主要通过实例来记忆:

<html>
<head>
<title><h1>HTML basic tag</h1></title>
</head>
<body>
<h1>This is a heading.</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph</p>
<font size="+1" color="blue" face="Times">This is font size+1 based on default size.</font><br>
This displayed as <i>italic</i> <br>
<a href="http://www.cnblogs.com/sevennight/">This is a link.</a><br>
<img src="http://flowerinfo.org/wp-content/gallery/rose-flowers/rose-flower-14.jpg" width="300" height="200"/>
</body>
</html>


效果如下:

HTML basic tag

This is a heading.

This is a paragraph.

This is another paragraph

This is font size+1 based on default size.

This displayed as italic

This is a link.



<marquee behavior="scroll" direction="right" scrolldelay="40" bgcolor="lightblue"
vspace="40">
<h2 style="margin:10px">roll...</h2>
</marquee>


<hr/>: 创建水平线

二、HTML文本格式化

2.1

<html>
<body>
<b>This text is bold</b><br />
<strong>This text is strong</strong><br />
<big>This text is big</big><br />
<em>This text is emphasized</em><br />
<i>This text is italic</i><br />
<small>This text is small</small><br />
This text contains<sub>subscript</sub><br />
This text contains<sup>superscript</sup>
</body>
</html>


效果如下:

This text is bold

This text is strong

This text is big

This text is emphasized

This text is italic

This text is small

This text contains
subscript

This text contains
superscript

2.2 预格式文本
因为在html代码中多个空格和多行也视为一个空格,而pre标签可以保留空格和换行,适合显示源代码。

比如:

<pre>
eg.
<pre>pre tag contaiins the namespace and ctrl style..</pre>
</pre>


结果:

eg.

pre tag contaiins the namespace and ctrl style.


2.3 缩写和首字母的缩写

<html>

<body>

<abbr title="etcetera">etc.</abbr>
<br />
<acronym title="World Wide Web">WWW</acronym>

<p>在某些浏览器中,当您把鼠标移至缩略词语上时,title 可用于展示表达的完整版本。</p>

<p>仅对于 IE 5 中的 acronym 元素有效。</p>

<p>对于 Netscape 6.2 中的 abbr 和 acronym 元素都有效。</p>

</body>
</html>


结果:

etc.

WWW

在某些浏览器中,当您把鼠标移至缩略词语上时,title 可用于展示表达的完整版本。

仅对于 IE 5 中的 acronym 元素有效。

对于 Netscape 6.2 中的 abbr 和 acronym 元素都有效。

2.4 长引用和短引用

这是长引用:

<blockquote>这是长引用。blockquote>

这是短引用:

<q>这是短引用。</q>


这是长引用:

这是长引用。

这是短引用: 这是短引用。

2.5 删除文本和下划线文本

<del>删除文本</del>
<ins>下划线文本</ins>


删除文本 下划线文本

以下引用自W3Cschool:

文本格式化标签

标签描述
<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>定义一个定义项目。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: