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
  • 相关阅读:
    RSA算法
    随机数相关面试题
    黑冰
    Servlet
    中国文人的弱点
    黑客与画家
    J2SE、JS及JavaWeb的若干知识
    离婚前规则
    自己写的一个智能指针类
    用_makepath和_splitpath构造路径&分解路径
  • 原文地址:https://www.cnblogs.com/wendcn/p/12745580.html
Copyright © 2011-2022 走看看