初学前端开发——CSS

综合案例之白嫖小米广告

废话不多说,上代码,本来想用盒子模型外边距跟内边距来做,但是发现之前学的文字语言也能用,甚至还更方便一点,也不怕乱设内边距撑开盒子

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
         *{
        padding: 0;
        margin: 0;
    }
    body{
        background-color: #f5f5f5;
    }
    .box
    {
        width: 298px;
        height: 415px;
        background-color:#fff;
        /* 让块级盒子水平居中对齐 */
        margin: 100px auto;
    }
    .box img{
        width: 100%;
    }
    .review
    {
        text-align: center;
        font-size: 14px;
        text-align: center;
    }
    .apprise
    {
        text-align:center;
        font-size: 12px;
        color:#b0b0b0;
        margin: 5px;
    }
    .price
    {
        margin: 20px;
        text-align:center;
        color:#ff6700;
    }
    </style>
   
</head>
<body>
    <div class="box">
        <img src="https://cdn.cnbj1.fds.api.mi-img.com/nr-pub/202304171459_dd35f1e6215da63c356e352d4d398ce6.png?thumb=1&w=300&h=300&f=webp&q=90" alt="">
        <p class="review">Xiaomi 13 Ultra</p>
        <div class="apprise">徕卡光学全焦段四摄|一英寸可变光圈</div>
        <div class="price">5999起</div>
    </div>
</body>
</html>

效果图

综合案例之白嫖小米快报

这里用到一个去掉  li  列表小圆点的操作

语法:

list-style:none;

上整体代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding:0;
            margin:0;
        }
        .box
        {
            width:248px;
            height:163px;
            border: 1px solid #CCC;
            margin:100px auto;
        }
        .box h3
        {
            border-bottom: 1px dotted #ccc; 
            height:32px;
            font-weight:normal;
            line-height:32px;
            font-size:14px;
            padding-left:15px;
            color:#ccc;
        }
        li
        {
            list-style:none;
        }
        .box ul
        {
            margin-top: 7px;
        }
        .box ul li
        {
            height:23px;
            padding-left:20px;
        }
        .box ul li a
        {

            text-decoration:none;
            font-size:12px;
            color:#666;
        }
        .box ul li a:hover
        {
            text-decoration:underline;
        }
    </style>
</head>
<body>
    <div class="box">
        <h3>品优购快报</h3>
        <ul>
            <li><a href="#">【特惠】爆款耳机5折秒!</a></li>
            <li><a href="#">【特惠】母亲节,健康好礼低至5折!</a></li>
            <li><a href="#">【特惠】爆款耳机5折秒!</a></li>
            <li><a href="#">【特惠】9.9元洗100张照片!</a></li>
            <li><a href="#">【特惠】长虹智能空调立省1000!</a></li>
        </ul>
    </div>
</body>
</html>

效果图

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值