css+html案例

复制代码
<!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>
相关推荐
ZC跨境爬虫15 小时前
跟着 MDN 学CSS day_37:(从文档流到粘性定位的底层原理)
前端·javascript·css·ui·html
ZC跨境爬虫16 小时前
跟着 MDN 学CSS day_40:(Flexbox实战技能测试)
前端·css·ui·html·tensorflow
ZC跨境爬虫16 小时前
跟着 MDN 学CSS day_36:(float、clear与BFC深度解析)
前端·javascript·css·ui·交互
用户0595401744619 小时前
把 AI Agent 记忆验证从手工比对换成 Pytest + 向量数据库,测试效率提升 10 倍
前端·css
LaughingZhu20 小时前
Product Hunt 每日热榜 | 2026-05-31
前端·人工智能·经验分享·搜索引擎·chatgpt·html
Xp0219110320 小时前
知网研学、万方、WPS、大以论文四大排版工具横评,新用户免费排版等你领!
前端·css·html·生活·wps·论文排版
江湖伤心人20 小时前
工具分享--IP与域名提取工具3.0
html·蓝队监测
new【一个】对象20 小时前
前端的概述
html
ZC跨境爬虫21 小时前
跟着 MDN 学CSS day_42:等分轨道、层叠放置与混合布局
前端·javascript·css·ui·html
神奇的代码在哪里21 小时前
【单机离线版】大学考试题库复习工具:前端离线Excel解析 + localStorage持久化 + Playwright
前端·html·ai编程·题库复习·刷题软件·大学考试