上标、下标~不常用的 html 标签

本文介绍了HTML中多种文本格式化的技巧,包括使用不同标签实现文本的大号、小号、粗体、斜体、闪动、固定宽度字体、删除线、颜色、大小调整等,并展示了如何通过JavaScript动态生成这些格式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<sup>上标 

<sub>下标

<small>小号字

<del> 删除线

======》

 

 

对应的 js 

stringObj.sup()  上标

stringObj.sub()  下标

stringObj.sub()  使用小字号显示

stringObj.strike() 使用删除线

 

 

彩蛋:

<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<title>Document</title>
	</head>
	<body>
		<script type="text/javascript">
			var txt = "z-one"

			document.write("<p>1、Big--大号字体: " + txt.big() + "</p>")
			document.write("<p>2、Small--小号字体: " + txt.small() + "</p>")

			document.write("<p>3、Bold--粗体: " + txt.bold() + "</p>")
			document.write("<p>4、Italic--斜体: " + txt.italics() + "</p>")

			document.write("<p>5、Blink--字符串闪动: " + txt.blink() + " (does not work in IE)</p>")
			document.write("<p>6、Fixed--以打印机文本显示: " + txt.fixed() + "</p>")
			document.write("<p>7、Strike--删除线: " + txt.strike() + "</p>")

			document.write("<p>8、Fontcolor--字体颜色: " + txt.fontcolor("Red") + "</p>")
			document.write("<p>9、Fontsize--字体大小: " + txt.fontsize(16) + "</p>")

			document.write("<p>10、Lowercase--转换为小写: " + txt.toLowerCase() + "</p>")
			document.write("<p>11、Uppercase--转换为大写: " + txt.toUpperCase() + "</p>")

			document.write("<p>12、Subscript--下标: " + txt+txt.sub() + "</p>")
			document.write("<p>13、Superscript--上标: " +txt+ txt.sup() + "</p>")

			document.write("<p>14、Link--链接: " + txt.link("http://www.cnblogs.com/z-one") + "</p>")
		</script>

	</body>

</html>

结果:

 

转载于:https://www.cnblogs.com/z-one/p/6134824.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值