网页基础(十)CSS字体样式

一.span

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>span</title>
		<style>
			#span1{
				color: red;
				font-weight: bold;
				
			}
			#span2{
				color: blue;
			}
		</style>
	</head>
	<body>
		<p><span id="span1">span</span>标签是一个<span id="span2">行内元素</span></p>
	</body>
</html>

二.字体类型

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>设置字体类型</title>
		<!--
        	作者:770267939@qq.com
        	时间:2020-02-26
        	描述:font-family: 设置字体类型
        -->
        <style>
        	.f1{
        		font-family: "宋体";
        	}
        	.f2{
        		font-family: "微软雅黑";
        	}
        </style>
	</head>
	<body>
		<p class="f1">宋体</p>
		<p class="f2">微软雅黑</p>
	</body>
</html>

三.字体大小

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>字体大小</title>
		<!--
        	作者:770267939@qq.com
        	时间:2020-02-26
        	描述:font-size:设置字体大小
        	px:默认16像素
        <-->
        
        <style>
        	.p1{
        		font-size: 16px;
        	}
        	.p2{
        		font-size: 50%;
        	}
        	.p3{
        		font-size: 1.5em;
        	}
        </style>
	</head>
	<body>
		<p class="p1">唐僧</p>
		<p class="p2">孙悟空</p>
		<p class="p3">猪八戒</p>
	</body>
</html>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>字体风格</title>
		<style>
			.p1{
				font-style: normal;
			}
			.p2{
				font-style: italic;
			}
			.p3{
				font-style: oblique;
			}
		</style>
	</head>
	<body>
		<p class="p1">普通字体</p>
		<p class="p2">斜体</p>
		<p class="p3">倾斜体</p>
	</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值