html5初学day5[作业]

仿照http://www.loveo.cc/using-css-to-make-cards-ui.html进行编写

========================================================

html文档

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>心情日记</title>
    <link href="day5.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class="card">
    <div class="img">
    <img src="../img/day5.jpg">
    </div>
    <div class="p">
        <p class="p1">纵有千百个理由放弃</p>
        <p class="p2">也总会找一个理由坚持下去</p>
    </div>
</div>
</body>
</html>
=============================================================================

css文档

.card{
    margin: 0px auto;
    width: 600px;
    background-color: white;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.img{
    height: 300px;
    position: relative;
    overflow: hidden;
}
.img img{
    width: 100%;
    position: absolute;
    top:45%;
    left: 50%;
    transform: translate(-50%,-50%);
    filter: grayscale(1);
    transition-property: filter width;
    transition: 3s;
    transition-timing-function: ease;
}
.p{
    text-align: center;
    padding: 15px 20px;
    box-sizing: border-box;
}
.p .p1{
    font-family: fantasy;
    font-size: 16px;
    color:darkolivegreen;
}
.p .p2{
    font-family: fantasy;
    font-size: 18px;
    color:darkslateblue;
}
=======================================================================

效果图:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值