会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132647个问题

<!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>

        *{
            margin: 0;
            padding: 0;
        }

        body{
            background-color: #f1f1f1;
        }

        .container{
            width: 1240px;
            margin: 0 auto;
        }

        .container ul{
            overflow: hidden;
            clear: both;
        }

        .container ul li{
            position: relative;
            float: left;
            list-style: none;
            background-color: #fff;
            margin-top: 10px;
            margin-right: 9px;
            width: 303px;
            height: 375px;
        }

        .container ul li a img{
            height: 230px;
            margin-top: 30px;
        }

        .container ul li:nth-child(4n){
            margin-right: 0;
        }

        .container ul li a{
            display: block;
            width: 100%;
            height: 100%;
            text-align: center;
            text-decoration: none;
        }

        .text .name{
            display: block;
            color: #333;
            font-size: 16px;
            margin-bottom: 2px;
        }

        .text .desc{
            display: block;
            color: #999;
            font-size: 14px;
        }
 
        .text .price i{
            font-style: normal;
            font-size: 14px;
            bottom: 3px;
        }
 
        .text .price{
            display: inline-block;
            color: #c00;
            font-size: 22px;
            padding-left: 14px;
        }
 
        .text .price em{
            font-size: 16px;
            font-style: normal;
        }
 
        .product-sign{
            position:absolute;
            top: 30px;
            left: 30px;
            display: block;
            width: 60px;
            height: 60px;
            background-color: #ff64a6;
            border-radius: 50%;
            line-height: 60px;
            color: #fff;
            font-size: 16px;
            text-align: center;
        }
 
 
    </style>
</head>
<body>
   
    <div class="container">
        <ul>
            <li>
                <a href="#">
                    <img src="./1.png" alt="">
                    <div class="text">
                        <span class="name">魅族 18</span>
                        <span class="desc">限时领券最高立省1000 | 12期免息</span>
                        <span class="price"><i>¥</i>3900<em>起</em></span>
                    </div>
                    <span class="product-sign">免息</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="./1.png" alt="">
                    <div class="text">
                        <span class="name">魅族 18</span>
                        <span class="desc">限时领券最高立省1000 | 12期免息</span>
                        <span class="price"><i>¥</i>3900<em>起</em></span>
                    </div>
                    <span class="product-sign">免息</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="./1.png" alt="">
                    <div class="text">
                        <span class="name">魅族 18</span>
                        <span class="desc">限时领券最高立省1000 | 12期免息</span>
                        <span class="price"><i>¥</i>3900<em>起</em></span>
                    </div>
                    <span class="product-sign">免息</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="./1.png" alt="">
                    <div class="text">
                        <span class="name">魅族 18</span>
                        <span class="desc">限时领券最高立省1000 | 12期免息</span>
                        <span class="price"><i>¥</i>3900<em>起</em></span>
                    </div>
                    <span class="product-sign">免息</span>
                </a>
            </li>
        </ul>
    </div>
</body>
</html>

.container ul li{

            position: relative;

}这里面的position一定要用relative相对定位吗?

WEB前端全系列/第一阶段:HTML5+CSS3模块/浮动与定位 376楼

你好老师,为啥我用新标签这个完全显示不了?没看出问题在哪儿
<!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>
        .header{
            width: 1400px;
            background-color: pink;
        }
        div{
            margin-top: 10px;
            height: 600px;
        }
        .nav{
            height: 80px;
            margin-top: 10px;
            background-color: pink;
        }
        .section{
            width: 900px;
            margin-top: 10px;
            background-color: pink;
            height: 600px;
            float: left;
        }
        aside{
            width: 480px;
            margin-top: 10px;
            background: pink;
            height: 600px;
            float: right;
        }
        .footer{
            height: 80px;
            margin-top: 10px;
            background-color: pink;
        }
    </style>
</head>
<body>
    <header>头部</header>
    <nav>导航</nav>
    <div>
        <section>主要内容</section>
        <aside>侧边栏</aside>
    </div>
    <footer>脚部</footer>
</body>
</html>


WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5新增元素 379楼

为什么我的main主要内容和侧边栏显示不出来,代码如下:
<!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>
        .container{
            width: 1400px;
            margin: 0 auto;
        }
        .header{
            height: 80px;
            margin-top: 10px;
            background:pink
        }
        .nav{
            height: 80px;
            margin-top: 10px;
            background: pink;
        }
        .main{
            height: 500px;
            margin-top: 10px;
        }  
        .mian .left{
            float: left;
            width: 900px;
            height: 500px;
            background: pink;
        }
        .mian .right{
            float: right;
            width: 480px;
            height: 500px;
            background: pink;
        }
        .footer{
            height: 80px;
            background: pink;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">头部</div>
        <div class="nav">导航</div>
        <div class="main">
            <div class="left">主要内容</div>
            <div class="right">侧边栏</div>
        </div>
        <div class="footer">脚部</div>
    </div>
</body>
</html>


WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5新增元素 380楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/浮动与定位 382楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/浮动与定位 383楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS选择器 385楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/前端入门与基础知识 388楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS选择器 389楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637