前端学习笔记css-05(练习案例)

css练习案例
1、滑动门
在这里插入图片描述
2、手机网站首页
在这里插入图片描述

1、代码实现
图片素材
请添加图片描述在这里插入图片描述请添加图片描述请添加图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>导航栏</title>
    <style type="text/css">
        li{
            list-style: none;
            float: left;
        }
        li a{
            background-image: url(bg_r1_c1.png);
            background-repeat: no-repeat;
            height: 35px;
            padding-left: 7px;
           display:inline-block;
           color: white;
        }
        li a span{
            background-image: url(bg_r1_c2.png);
            height: 35px;
            display:inline-block;
            background-repeat: no-repeat;
            background-position: right;
            line-height: 35px;
            padding-right: 30px;
        }
        li a:hover{
            background-image: url(bbg_r1_c1.png);
        }
        li a:hover span{
            background-image: url(bbg_r1_c2.png);
        }
    </style>
</head>
<body>
    <ul>
        <li>
            <a href="">
                <span>
                    百度一下
                </span>
            </a>
        </li>
        <li>
            <a href="">
                <span>
                    百度
                </span>
            </a>
        </li>
        <li>
            <a href="">
                <span>
                    中国新闻网
                </span>
            </a>
        </li>
    </ul>

</body>
</html>

2、代码实现

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>手机首页</title>
    <style type="text/css">
         body {
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            font-size: 14px;
            line-height: 1.428571429;
            color: #333333;
            background-color: #ffffff;
            width: 100%;
        }
        input{
            border: 0 none;
            outline-style: none;
        } 
        li{
         display: list-item;
         text-align: -webkit-match-parent;
        }
        ul {
              list-style: none;
        }
        img {
            border: 0 none;
        }
        p {
            display: block;
            margin-block-start: 1em;
            margin-block-end: 1em;
            margin-inline-start: 0px;
            margin-inline-end: 0px;
        }
        .header{
            height: 62px;
            width: 980px;
            margin: 0 auto;
        }
        .logo{
            width: 179px;
            height: 39px;
            margin-top: 20px;
            float: left;
        }
        .logo img{
            border: 0 none;
        }
        .search{
            margin-top: 12px;
            float: right;
            border-radius: 5px; /*这句就是重点,让边框变为圆角*/
            border: 1px solid rgb(182, 175, 175); /*让边框变为1px宽度,直线,#CCC颜色*/
            width: 300px;
        }
        .txt{
            width: 250px;
            height: 34px;
            float: left;
        }
        .btn{
            margin-top: 2px;
            width: 34px;
            height: 34px;
            background-image: url(images/search2.jpg);
            float: right;
        }
        .nav{
            width: 980px;
            margin: 0 auto;
            height: 55px;
            background-image: url(images/nav_bg.png);
        }
        .nav li {
          float: left;
        }
        
        .nav li a{
            height: 55px;
            line-height: 55px;
            display: inline-block;
            background-image: url(images/nav_bg-line.png) no-repeat right top;
            padding: 0 46px;
            font-weight: 700;
            color: #000;
        }
        .banner{
            width: 980px;
            margin: 0 auto;
        }
        .gg{
            width: 980px;
            margin: 0 auto;
            height: 29px;
            border-top: 1px solid #EFEFEF;
            border-bottom: 1px solid #EFEFEF;
            margin-bottom: 12px;
            background: #FBFBFB;
        }
         .l-gg{
            float: left;
            line-height: 29px;
        }
        .r-gg{
            float: right;
            margin-top: 6px;
        }
        .news {
            width: 980px;
            margin: 15px auto;
        }
        .clearfix {
            zoom: 1;
        }
        .products{
            width: 310px;
            height: 224px;
            border: 1px solid #E4E4E4;
            margin-right: 12px;
            position: relative;
            float: left;
        }
        
        .newlists{
            height: 224px;
            width: 373px;
            border: 1px solid #E4E4E4;
            float: left;
        }
        .jishu{
            height: 224px;
            width: 268px;
            border: 1px solid #E4E4E4;
            float: right;
        }
        .news-pub {
            margin-top: 13px;
            margin-left: 6px;
            color: #7AB800;
        }
        .news-pub img {
            vertical-align: middle;
        }
        .pro-pic{
            position: absolute;
            left: 60px;
            top: 50px;
        }
        .l-sj {
            position: absolute;
            left: 23px;
            top: 120px;
        }
        .r-sj {
            position: absolute;
            right: 23px;
            top: 120px;
        }
        .newslist-list {
            margin: 10px 18px 0 23px;
        }
        .newslist-list li {
            height: 27px;
            border-bottom: 1px dashed #DCDCDC;
            line-height: 27px;
        }
        .ftcolor {
            color: red;
            font-weight: 700;
        }
        .j-pub {
            height: 12px    ;
            border-left: 3px solid #7AB800;
            margin-top: 10px;
            margin-left: 28px;
            padding-left: 5px;
        }
        .jishu p {
            margin-top: 30px;
            margin-left: 28px;
            line-height: 18px;
        }
        /**
        内部的DIV如果设置了float样式,则外部的容器DIV因为内部没有clear,导致不能被撑开。
        这个clearfix的CSS使用了after这个伪对象,它将在应用clearfix的元素的结尾添加content中的内容。
        在这里添加了一个句号".",并且把它的display设置成block;高度设为0;clear设为both;visibility设为隐藏,这样就达到了撑开容器的目的。

        **/
        .clearfix:after {
            content: ".";
            display: block;
            height: 0;
            line-height: 0;
            visibility: hidden;
            clear: both;
        }
        .footer {
            width: 980px;
            margin: 0 auto;
            height: 221px;
            background: #2D2D2D;
            border-bottom: 1px dashed #414141;
        }

        .footer-mid dl {
            margin-left: 100px;
            display: inline-block;
            margin-top: 20px;
            margin-right: 60px;
        }
        .footer-mid dd {
            color: #C7C7C7;
        }
        .footer-mid dt {
            margin-top: 20px;
            color: #707070;
        }
        dt {
            display: block;
        }
        dl {
            display: block;
            margin-block-start: 1em;
            margin-block-end: 1em;
            margin-inline-start: 0px;
            margin-inline-end: 0px;
        }
        body, h1, h2, h3, h4, h5, h6, p, ul, dl, dd {
            margin: 0;
            padding: 0;
        }
        .bottom {
            width: 980px;
            margin: 0 auto;
            height: 54px;
            background: #2D2D2D;
            text-align: center;
            padding-top: 30px;
        }

        .bottom p {
            font-size: 12px;
            color: rgb(168, 165, 165);
            font-family: "宋体","微软雅黑";
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="logo">
            <img src="images/logo.jpg" alt="">
        </div>
        <div class="search">
            <input type="text" value="请输入..." class="txt">
            <input type="button" class="btn">
        </div> 
    </div>
    <div class="nav">
        <div class="nav-con">
            <ul>
                <li>
                    <a href="">首页</a>
                </li>
                <li>
                    <a href="">智能手机</a>
                </li>
                <li>
                    <a href="">平板电脑</a>
                </li>
                <li>
                    <a href="">配件</a>
                </li>
                <li>
                    <a href="">服务支持</a>
                </li>
                <li>
                    <a href="">关于尚合</a>
                </li>
            </ul>
        </div>
    </div>
    <div class="banner">
        <img src="images/banner.jpg" alt="">
    </div>
    <div class="gg">
        <div class="l-gg">
            最新公告:尚合Aone智能手机入网证已获取工信部门审批下发。尚合官网
        </div>
        <div class="r-gg">
            <img src="images/weibo.png" alt="">
            <img src="images/xinlang.png" alt="">
            <img src="images/zone.png" alt="">
            <img src="images/renren.png" alt="">
        </div>
    </div>
    <div class="news clearfix">
        <div class="products">
            <div class="news-pub">
                <img src="images/o.jpg" alt="">
                <span>技术与支持</span>
            </div>
            <div class="pro-pic">
				<img src="images/home_hot_01.png" alt="">
            </div>
            <div class="l-sj">
				<img src="images/left.png" alt="">
            </div>
            <div class="r-sj">
				<img src="images/right.png" alt="">
			</div> 
        </div>
        <div class="newlists">
            <div class="news-pub">
				<img src="images/o.jpg" alt="">
				<span>新闻中心</span>
            </div>
            <ul class="newslist-list">
                <li class="ftcolor">致歉公告</li>
                <li>首批尚合Aonet已全部售馨!</li>
                <li>【媒体报导】国产高性价比 尚合Aonet四核手机评测</li>
                <li>我司产品已经通过了国家强制性产品3C认证</li>
                <li>尚合Aone智能手机入网证已经获工信部门审批下发.</li>
                <li>我司通过ISO9001:2008国际质量管理体系认证</li>
            </ul>
        </div>
        <div class="jishu">
            <div class="news-pub">
                <img src="images/o.jpg" alt="">
                <span>技术与支持</span>
            </div>
            <div class="j-pub">售后服务</div>
            <div class="j-pub">投诉和建议</div>
            <div class="j-pub">联保网点</div>
            <div class="j-pub">常见问题</div>
            <p>深圳市汇聚众合科技发展有限公司
                <br/>
                服务热线:400-633-7922
            </p>
        </div>
    </div>
    <div class="footer">
        <div class="footer-mid">
            <dl>
                <dd>尚合首页</dd>
                <dt>返回首页</dt>
            </dl>
            <dl>
                <dd>尚合首页</dd>
                <dt>返回首页</dt>
            </dl>
            <dl>
                <dd>尚合首页</dd>
                <dt>返回首页</dt>
            </dl>
            <dl>
                <dd>尚合首页</dd>
                <dt>返回首页</dt>
            </dl>
        </div>
    </div>
    <div class="bottom">
        <p>深圳市会居中和优先公司深圳市会居中和优先公司深圳市会居中和优先公司深圳市</p>
    </div>
</body>
</html>

素材:
链接:https://pan.baidu.com/s/1YLillcFBxVmIcwB5sNv0CQ
提取码:asqi

陌生的css样式

:after
vertical-align: middle;
margin-block-start
margin-block-end
margin-inline-start
margin-inline-end
text-align: -webkit-match-parent

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值