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>
相关推荐
Dxy12393102162 小时前
html鼠标定位线
前端·html·计算机外设
Dxy12393102163 小时前
HTML 如何随时保存用户操作数据:防止刷新丢失的完整指南
前端·html
厚积而薄发15283 小时前
我复刻了一个“会避嫌”的登录页,还把它开源了
css·开源·用户体验
Dxy12393102163 小时前
前端函数设计指南:从 HTML 中的 JavaScript 函数到模块化实践
前端·javascript·html
Amctwd4 小时前
【Android】将 html 打包为 apk
android·html·harmonyos
kyriewen1116 小时前
给浏览器画个圈:CSS contain 如何让页面从“卡成PPT”变“丝滑如德芙”
开发语言·前端·javascript·css·chrome·typescript·ecmascript
bdawn1 天前
SCSS、CSS 和 SASS 之间的联系与区别
css·sass·预处理·编译·scss
阿珊和她的猫1 天前
微信小程序 WXSS 与 CSS 的区别
css·微信小程序·notepad++
xingyynt1 天前
【HTML+CSS】使用HTML与后端技术连接数据库
css·数据库·html