zoukankan      html  css  js  c++  java
  • 关于CSS设置样式的一点建议

      在一个网页中有多个控件,每一个控件也可能有多种型号,还可能想有多种颜色配置,那么我们在设置css样式的时候可以把宽度、高度设为一类,把颜色设为一类,把公共样式设为一类,最终每一个控件可根据需要包含三个类。

    比如我们的样式表设置如下:

    <style type="text/css">
        .small{ 500px;height: 40px;font-size: 8px}
        .normal{ 500px;height: 60px;font-size: 20px}
        .large{ 500px;height: 100px;font-size: 40px}
        .red{background: red}
        .blue{background: blue}
        .com{border: 1px solid;font-family: 楷体;color:#fff;}
    </style>

    前台控件设置如下

    <body>
        <div class="small red com">small red</div>
        <div class="small blue com">small blue</div>
        <div class="normal red com">normal red</div>
        <div class="normal blue com">normal blue</div>
        <div class="large red com">large red</div>
        <div class="large blue com">large blue</div>
    </body>

    显示效果

    small red
    small blue
    normal red
    normal blue
    large red
    large blue
  • 相关阅读:
    react结合antd4.0和umi3.0的404界面
    小程序自带组件自定义tabbar
    移动安全学习清单
    跨域资源共享 CORS 详解(转)
    docker常用命令总结
    XSS绕过小结
    mysql的order by注入
    本地文件包含漏洞利用姿势
    XSS绕过<>进行测试
    clamscan+clam-freshclam.service服务启停
  • 原文地址:https://www.cnblogs.com/wendcn/p/12745580.html
Copyright © 2011-2022 走看看