html+css知识总结(2)

1:焦点图案例

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>轮播图</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        li{
            list-style: none;
        }
        .prev,.next{
            position: absolute;
            top:  50%;
            margin-top: -15px;
            width: 20px;
            height: 30px;
            background: rgba(0, 0, 0, 0.3);
            text-align: center;
            line-height: 30px;
            color: #fff;
            text-decoration: none;
        }
        .tb-promo{
            position: relative;
            width: 520px;
            height: 280px;
            background-color: pink;
            margin: 50px auto;
        }
        .tb-promo img{
            width: 100%;
            height: 100%;
        }
        .prev{
            left: 0;
            border-top-right-radius: 15px;
            border-bottom-right-radius: 15px;
            
        }
        .next{
            right: 0;
            border-top-left-radius: 15px;
            border-bottom-left-radius: 15px;
            
        }
        .promo-nav{
            position: absolute;
            bottom: 10px;
            left: 50%;
            margin-left: -35px;
            width: 70px;
            height: 13px;
            background-color: pink;
            background: rgba(255,255,255,.3);
            border-radius: 7px;
        }
        .promo-nav li{
            float: left;
            width: 8px;
            height: 8px;
            background-color: #fff;
            border-radius: 50%;
            margin: 3px;
        }
        .promo-nav .selected{
            background-color: #ff5000;
 
        }
    </style>
</head>
<body>
    <div class="tb-promo">
        <img src="meishi6.jpeg" alt="">
        <a href="#" class="prev">&lt;</a>
        <a href="#" class="next">&gt;</a>
        <ul class="promo-nav">
            <li class="selected">
 
            </li>
            <li>
 
            </li>
            <li>
 
            </li>
            <li>
 
            </li>
            <li>
 
            </li>
        </ul>
    </div>
</body>
</html>

2:元素的显示

display:none //隐藏元素且不再占据空间
visibility //隐藏元素且继续占有原来的位置
overflow :hidden  //保证只显示盒子里面的内容
overflow :scoller/auto //未显示的内容出现滚动条,但是auto是超出才显示滚动条

3:经过tudo 显示mask图


.tudo:hover .mask{
  display:block}

4:溢出文字省略号

      1: 单行文字:     white-space: nowrap;  
       超出盒子的就隐藏     overflow: hidden;
       溢出的文字用省略号     text-overflow: ellipsis;

      2:多行文字:
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;  

5:加浮动可以让文字围绕浮动元素显示

6:css过渡让宽度慢慢增大

        div{
            width: 200px;
            height: 100px;
            background-color: pink;
            transition: width 0.5s ease 1s,height 0.5s ease 1s;
        }
        div:hover{
            width: 400px;
            height: 200px;
            color:blue
        }

       

transition: all 0.5s;  //让所有属性都改变

7:进度条

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>小陈的美食铺</title>
    <style>
        .bar{
            width: 150px;
            height: 15px;
            border:1px solid red;
            border-radius: 7px;
            padding: 1px;
        }
        .bar_in{
            width: 50%;
            height: 100%;
            background-color: red;
            transition: all 0.5s;
            border-radius: 7px;
        }
        .bar:hover .bar_in{
            width: 100%;
        }
    </style>
</head>
<body>
    <div class="bar">
        <div class="bar_in"></div>
    </div>
</body>
</html>

8:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值