<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.frontSty{
font-size: 50px;
/* 加粗效果 */
font-weight: 700; /* 400-normal 正常 ; 700-bold 加粗*/
/* 是否倾斜效果 italic-倾斜 normal-正常*/
font-style: normal;
}
.mydiv2{
height: 50px;
background-color: beige;
line-height: 50px; /*行高和div高度保持一致 形成垂直居中的效果,但是只能用于单行文字*/
}
.mydiv3{
font-family: '楷体';
}
.mydiv4{
/* 复合属性 依次是 是否倾斜 加粗 大小/行距 字体 注意:字号和字体必须写否则不生效 */
font: normal 700 30px/2 '楷体';
}
</style>
</head>
<body>
<div class="frontSty"> 测试字体样式</div>
<div class="mydiv2">定位</div>
<div class="mydiv3">字体测试</div>
<div class="mydiv4">字体复合属性 font 测试</div>
<div>
<!-- 测试居中效果 -->
<div style="width: 100px; text-align: center; background-color: aqua;">居中</div>
<div style="width: 100px; text-align: right; background-color: aqua;">居右</div>
<div style="width: 100px; text-align: left; background-color: aqua;">居左</div>
</div>
<div>
<!-- 去除效果 -->
<div style="text-decoration: none;">测试下划线</div>
<!-- 下划线 -->
<div style="text-decoration: underline;">测试下划线</div>
<!-- 删除线 -->
<div style="text-decoration: line-through;">测试下划线</div>
<!-- 上划线 -->
<div style="text-decoration: overline;">测试下划线</div>
</div>
</body>
</html>
css+html案例
星空2026-03-27 10:58
相关推荐
Da Da 泓3 小时前
HTML浅浅入门听风3475 小时前
windplay网页创意实验场福兮说16 小时前
设计稿是 #4A7C6F,页面量出来是 #4B7C6F:HEX、HSL、透明度、canvas 来回转的七个坑weixin_4482902520 小时前
书庐开发实战教学传人1 天前
悬停旋转放大和位移效果如何写geovindu1 天前
css: Timeline scribbleAccess开发易登软件2 天前
Access 导入 Markdown 表格:把文档里的数据写进表易朵朵2 天前
CSS 格式化上下文web打印社区2 天前
C-Lodop 提示未准备好或 WebSocket 没准备好:先让本机服务起来COOLMO研究AI2 天前
企业官网服务页的信息架构怎么设计:从用户问题到语义化 HTML