html和css进阶二

2018-06-24  本文已影响0人  潇潇雨歇_安然

一、table标签

 <table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

二、选择器的权重

三、定位

伪代码如下:

.box01{
    ......
    position:absolute;  /* 设置了绝对定位 */
    left:200px;            /* 相对于参照元素左边向右偏移200px */
    top:100px;          /* 相对于参照元素顶部向下偏移100px */
    z-index:10          /* 将元素层级设置为10 */
}
/* 设置元素透明度,将元素透明度设置为0.3,此属性需要加一个兼容IE的写法 */
opacity:0.3;
/* 兼容IE */
filter:alpha(opacity=30);

四、background背景图

最后看一个雪碧图的案例:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>background</title>
    <style>
    .list{
        width: 300px;
        /* border: 1px solid black; */
        margin: 0px auto;
        list-style: none;
    }
    .list li{
        height: 60px;
        border-bottom: 1px dotted black;
        background: url("images/bg01.png") no-repeat 0 10px;
        text-indent: 50px;
        line-height: 60px;
    }
    /* 图片间距是80px */
    .list .l2{
        background-position-y: -70px;
    }
    .list .l3{
        background-position-y: -150px;
    }
    .list .l4{
        background-position-y: -230px;
    }
    .list .l5{
        background-position-y: -310px;
    }
    .list li a{
        text-decoration: none;
        color: black;
    }
    </style>
</head>
<body>

    <ul class="list">
        <li><a href="#">我们的我们</a></li>
        <li class="l2"><a href="">我们的我们</a></li>
        <li class="l3"><a href="">我们的我们</a></li>
        <li class="l4"><a href="">我们的我们</a></li>
        <li class="l5"><a href="">我们的我们</a></li>
    </ul>

</body>
</html>
上一篇下一篇

猜你喜欢

热点阅读