<small id='koacc9tn'></small><noframes id='ossrq7ta'>

    <tfoot id='p03cu6py'></tfoot>

  • 您的位置:荆州电脑信息网 > 设置问题 > css设置上下样式覆盖的问题

    css设置上下样式覆盖的问题

    作者:电脑信息网日期:

    返回目录:设置问题


    <html>
    <head>
    <style>
    body {
    position:relative;
    z-index:0;
    }
    #div1 {
    width:200px;
    height:100px;
    background-color:red;
    z-index:10;
    }
    #div2 {
    width:150px;
    height:80px;
    margin:-20px 0 0 20px;
    background-color:blue;
    z-index:20;
    }
    </style>
    </head>
    <body>
    <div id="div1">div1</div>
    <div id="div2">div2</div>
    </body>
    </html>

    这样就zhidao可以



    很简单,你直接在这个div上添加样式就行copy了。

    <div class="3" style="width:200px;......"></div>

    你看一下那个div class 3 里面都定义了哪些。
    比如定义了width height padding什么,你想调整哪个,就zhidao直接在上面的style后面加就行了,会覆盖,要注意一致就OK了。

    重叠在一起需要改变默认的布局方式,将其中一个显示在上层需要设置深度顺序,这两点分别用如下样式完成

    position: absolute; /*设置为绝对定位*/
    z-index:999;        /*设置重叠的上下次序,值越大月在上方*/

    示例如下

    1. 创建Html元素

      <div class="top">
      <div class="b">我是绝对定位,并且重叠在上方</div>
      <div class="a">我是默认定位</div>
      </div>
    2. 设置css样式

      div.top{margin:50px;padding:20px;width:200px;height:200px;border:2px dashed #ebbcbe;}
      div.top div{width:100px;height:100px;padding:10px;color:white;}
      div.a{background:red;}
      div.b{background:green;position:absolute;top:100px;left:100px;z-index:999;}
    3. 观察显示效果



    很简单,你直接在这个div上添加zhidao样式就行了。

    <div class="3" style="width:200px;......"></div>

    你看一下那个div class 3 里面都定义了哪些。
    比如定义了width height padding什么,你想调整哪个,就直接在上面的style后面加就行了,会覆盖,要注意一致就OK了。

      <tbody id='pop7yaiv'></tbody>
      <tfoot id='xtgn9xoq'></tfoot>

      <small id='5n77wai5'></small><noframes id='4a40s1y3'>

    • 相关阅读

      • css设置上下样式覆盖的问题

      • 电脑信息网设置问题