| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4539 人关注过本帖
标题:这段代码怎么简化?
只看楼主 加入收藏
好一坨牛粪
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2020-9-4
结帖率:100%
收藏
 问题点数:0 回复次数:1 
这段代码怎么简化?
这段代码怎么简化?
程序代码:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>淘宝广告栏</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        a {
            text-decoration: none;
        }
        ul {
            list-style: none;
        }
        .dahe {                    
            width: 540px;
            height: 300px;
            border: 1px solid red;
            margin: 50px auto;
        }
        .ad {
            width: 520px;
            height: 280px;
            background-color: #fff;
            margin: 10px;
            position: relative; /*给第二个盒子相对定位 子绝父相*/
        }
        .tu-l,
        .tu-r {
            background-color: rgba(0,0,0,.4);
            width: 20px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            position: absolute; /*给子盒子绝对定位*/
            top: 50%;            /*垂直居中两个按钮*/
            margin-top: -15px;

        }
        .tu-l a,
        .tu-r a {
            color: #fff;
            font-weight: 700;
        }
        .tu-l {
            left: 0;
            border-radius: 0 50% 50% 0;     /*左边圆角设置*/
        }

        .tu-r {
            right: 0;
            border-radius: 50% 0 0 50%;     /*右边圆角设置*/
        }
        .tu-h {
            width: 60px;
            height: 12px;
            background-color: rgba(255,255,255,0.4);
            border-radius: 10px;
            position: absolute;
            left: 50%;                    /*垂直居中下方按钮*/
            margin-left: -30px;
            bottom: 30px; 
        }
        .tu-h li {
            width: 8px;
            height: 8px;
            background-color: #fff;
            float: left;
            margin: 2px;        
            border-radius: 50%; /*给li盒子改变圆形*/
        }
        .tu-h li:hover {
            background-color: #f40;
        }
    </style>
</head>
<body>
<div class="dahe">
    <div class="ad">
        <img src="imges/tu.jpg" alt="图像被外星人带走了" />
        <div class="tu-l"><a href="#">></a></div>
        <div class="tu-r"><a href="#"><</a></div>
        <div class="tu-h">
            <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>
            </ul>
        </div>
    </div>
</div>
</body>
</html>
搜索更多相关主题的帖子: 代码 left class div href 
2020-09-11 20:31
yuyouxsdh
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2020-10-3
收藏
得分:0 
就是简单的css和html
css赋予其样式 已经是最简单的写法了
但现在流行的是嵌套前端框架赋予网页样式 bootstrap mui 等(可以学框架 方便 快捷 高效)
2020-10-03 10:47
快速回复:这段代码怎么简化?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015159 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved