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>
相关推荐
feixing_fx5 小时前
告别枯燥字体:Web 字体加载策略与 font-display 最佳实践
前端·css·前端框架·交互·css3
ClouGence7 小时前
不用编程,物理老师也能用AI一键生成交互式课件
人工智能·html·aigc
ly76899 小时前
CSS 从入门到进阶:系统掌握现代网页样式与布局
前端·css
前端技术官10 小时前
一行 CSS 新特性干掉 20 行 JavaScript ?
css·滚动驱动动画·容器查询·:has()·anchor positioning
winfredzhang10 小时前
一个 HTML 文件的备忘录:纸间备忘(Memo on Paper)源码全解析
前端·html·导出·localstorage·备忘录·json和html
智商偏低10 小时前
bindFramebuffer
前端·javascript·html
IMPYLH11 小时前
HTML 的 <ins> 元素
前端·javascript·html
Beginner x_u13 小时前
Tailwind CSS 速通:有 CSS 基础的实战入门
css·tailwindcss·工程化
WL_arm1 天前
Vibe Coding(氛围编程)入门
javascript·css·人工智能·html5
天真小巫1 天前
2026.8.23总结
前端·html