关闭

HTML格式

223人阅读 评论(0) 收藏 举报

HTML定义了很多元素用来格式化输出,比如加粗和倾斜文本。
例如:
格式化文字

<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>

这个例子说明了在HTML里面可以怎样格式化文本。
预格式化文本

<html>
	<body>
		<pre>
This is 
preformatted text.
It preserves      both spaces 
and line breaks.
</pre>
		<p>
			The pre tag is good for displaying computer code:
		</p>
		<pre>
for i = 1 to 10
     print i
next i
</pre>
	</body>
</html>

这个例子说明了可以怎样用pre标签来控制换行和空格。
“计算机输出”标签

<html>
	<body>
		<code>
			Computer code
		</code>
		<br>
		<kbd>
			Keyboard input
		</kbd>
		<br>
		<tt>Teletype text</tt>
		<br>
		<samp>
			Sample text
		</samp>
		<br>
		<var>
			Computer variable
		</var>
		<br>
		<p>
			<b>Note:</b> These tags are often used to display
			computer/programming code.
		</p>
	</body>
</html>

这个例子说明了“计算机输出”标签在显示上的不同。
地址

<html>
	<body>
		<address>
			Donald Duck
			<br>
			BOX 555
			<br>
			Disneyland
			<br>
			USA
		</address>
	</body>
</html>

这个例子说明了如何用HTML书写一个地址。
缩写和首字母缩略法

<html>
	<body>
		<abbr title="United Nations">UN</abbr>
		<br>
		<acronym title="World Wide Web">WWW</acronym>
		<p>
			The title attribute is used to show the spelled-out version when
			holding the mouse pointer over the acronym or abbreviation.
		</p>
		<p>
			This only works for the acronym element in IE 5.
		</p>
		<p>
			This works for both the abbr and acronym element in Netscape 6.2.
		</p>
	</body>
</html>

<html>
	<body>
		<p>
			If your browser supports bi-directional override (bdo), the next line
			will be written from the right to the left (rtl):
		</p>
		<bdo dir="rtl">
			Here is some Hebrew text
		</bdo>
	</body>
</html>

这个例子说明了如何改变文字方向。
块引用

<html>
	<body>
		Here comes a long quotation:
		<blockquote>
			This is a long quotation. This is a long quotation. This is a long
			quotation. This is a long quotation. This is a long quotation.
		</blockquote>
		Here comes a short quotation:
		<q> This is a short quotation </q>
		<p>
			With the block quote element, the browser inserts line breaks and
			margins, but the q element does not render as anything special.
		</p>
	</body>
</html>

这个例子说明了如何处理大段引用和小块引用。
删除和插入文字

<html>
	<body>
		<p>
			a dozen is
			<del>
				twenty
			</del>
			<ins>
				twelve
			</ins>
			pieces
		</p>
		<p>
			Most browsers will overstrike deleted text and underline inserted
			text.
		</p>
		<p>
			Some older browsers will display deleted or inserted text as plain
			text.
		</p>
	</body>
</html>

这个例子说明了如何标记被删除或者插入的文本。


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:129204次
    • 积分:3638
    • 等级:
    • 排名:第9253名
    • 原创:256篇
    • 转载:0篇
    • 译文:0篇
    • 评论:7条
    文章均来自以下教程网
    文章分类
    文章存档
    最新评论