博主信息
博文 13
粉丝 0
评论 0
访问量 12643
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
7月5日作业:盒子/浮动/定位
执着的博客
原创
937人浏览过

1. 理解并写出外边距的三个特征: 同级塌陷,嵌套传递,自动挤压的案例;
2. 写案例,并分析内边距对盒中内容的影响,以及解决的三种方案是什么?
3. 浮动的实现原理与清除的技巧
4. 相对定位与绝对定位的区别与联系,并实例演示
5. 模仿完成课堂上的二个定位案例:模拟php中文网登陆(遮罩+绝对定位)和固定定位广告的展示方式

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        *{margin: 0;padding: 0;
        color: #424242;
            font-family: Arial;
        }
     .circle1,
     .circle2,
     .circle3,
     .circle4,
     .circle5{
         position: absolute;
         width: 100px;
         height: 100px;
         border:10px solid black;
         border-radius: 50%;
     }
     .plat{
         position: absolute;
         left: 50%;
         top: 50%;
         margin-left: -193px;
         margin-top: -93px;
         height: 185px;
         width: 380px;
     }
        .circle1{
            border-color: red;
            left: 0;
            top: 0;
        }
        .circle2{
            border-color: green;
            left:130px;
            top: 0px;

        }
        .circle3{
            border-color: aqua;
            left: 260px;
            top: 0px;
        }
        .circle4{
            border-color: blue;
            left:65px;
            top: 60px;
        }
        .circle5{
            border-color:black;
            left: 195px;
            top: 60px;
        }


        .nav{
            list-style-type: none;
        }
        .list-item{
            float: left;
            margin: 0px 10px;
            height: 30px;
            line-height:30px;


        }
        a{
            text-decoration: none;
        }
        /*清除浮动*/
        .nav::after{
            content:"";
            display:block;
            clear: both;
        }
        .nav .list-item a{
            padding: 0 5px;
            font-weight: bold;
            color: #f40;
            font-weight:bold;
            display:inline-block ;
        }
        .nav .list-item a:hover{
          background: #f40;
            color:#fff;
            border-radius: 15px;
        }



    </style>
</head>
<body>

    <ul class="nav">
        <li class="list-item"><a href="#">天猫超市</a></li>
        <li class="list-item"><a href="#">天猫国际</a></li>
        <li class="list-item"><a href="#">天猫会员</a></li>
    </ul>



<div class="plat">
    <div class="circle1"></div>
    <div class="circle2"></div>
    <div class="circle3"></div>
    <div class="circle4"></div>
    <div class="circle5"></div>
</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

批改状态:合格

老师批语:学习一定要有总结, 才会有进步
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学