css学习笔记(4)

CSS常用操作:


导航栏:

css:

ul{
    list-style-type: none;
    margin: 0px;
    padding: 0px;
    background-color: black;
    width: 400px;
    text-align: center;
}

a:link,a:visited{
    text-decoration: none;
    background-color: black;
    color: whitesmoke;
    width: 50px;
    text-align: center;
    font-size: large;
}
a:active,a:hover{
    background-color: cadetblue;
}

li{
    display: inline;
    padding: 3px;
    padding-left: 5px;
    padding-right: 5px;
}

html

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link href="dhl.css" type="text/css" rel="stylesheet">
</head>
<body>
<ul>
    <li><a href="#">导航1</a></li>
    <li><a href="#">导航1</a></li>
    <li><a href="#">导航1</a></li>
    <li><a href="#">导航1</a></li>
    <li><a href="#">导航1</a></li>
</ul>
</body>
</html>



图片处理:


html

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link href="hzw.css" type="text/css" rel="stylesheet">
</head>
<body>
<div>
    <div class="image">
        <a href="#">
            <img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
        </a>
        <div class="text">海贼王</div>
    </div>
    <div class="image">
        <a href="#">
            <img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
        </a>
        <div class="text">海贼王</div>
    </div>
    <div class="image">
        <a href="#">
            <img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
        </a>
        <div class="text">海贼王</div>
    </div>
    <div class="image">
        <a href="#">
            <img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
        </a>
        <div class="text">海贼王</div>
    </div>
    <div class="image">
        <a href="#">
            <img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
        </a>
        <div class="text">海贼王</div>
    </div>

</div>
</body>
</html>


css:

body{
    margin: 10px auto;
    width: 70%;
    height: auto;
    background-color: cadetblue;
}
.image{
    border: 1px solid darkgray;
    width: auto;
    height: auto;
    float: left;
    text-align: center;
    margin: 5px;
}

img{
    margin: 5px;

}

.text{
    font-size: 16px;
    margin-bottom: 5px;
}

a:active,a:hover{
    opacity: 0.5;
}






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值