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>
相关推荐
人工智能研究所7 分钟前
Claude + HyperFrames:用 HTML 方式制作视频,AI 时代一切皆可 HTML?
人工智能·html·音视频·ai 视频·hyperframes·claude-
广师大-Wzx5 小时前
JavaWeb:前端部分
java·前端·javascript·css·vue.js·前端框架·html
是上好佳佳佳呀5 小时前
【前端(七)】CSS3 核心属性笔记:单位、背景、盒子模型与文本换行
前端·笔记·css3
CDN3606 小时前
【踩坑实录】前端开发必看:一次由CSS缓存引发的线上事故与SEO反思
前端·css·缓存
keyipatience7 小时前
3.Linux基本指令2
前端·html
iReachers7 小时前
HTML打包EXE工具数据加密功能详解 - 加密保护HTML/JS/CSS资源
javascript·css·html·html加密·html转exe·html一键打包exe·exe打包
前端老石人9 小时前
前端网站换肤功能的 3 种实现方案
开发语言·前端·css·html
W.A委员会9 小时前
伪类与伪元素
前端·javascript·css
yivifu21 小时前
手搓HTML双行夹批效果
前端·html·html双行夹注
漂流瓶jz1 天前
运行时vs编译时:CSS in JS四种主流方案介绍和对比
前端·javascript·css