html小案例

2022-10-16 19:04:09 浏览数 (1)

html简单菜单栏

代码语言:shell复制
<!DOCTYPE html>
<html lang="zh-CN">

<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>
    <link rel="stylesheet" href="">
    <style>
        
        /* 简单菜单栏 */

        a {
            display: block;
            width: 230px;
            height: 40px;
            font-size: 16px;
            color: white;
            text-decoration: none;
            background-color: gray;
            text-indent: 2em;
            line-height: 40px;
        }

        a:hover {
            background-color: aqua;

        }

    </style>
</head>

<body>
    <a href="#">手机电脑</a>
    <a href="#">电视</a>
    <a href="#">笔记本</a>
    <a href="#">耳机</a>
    <a href="#">音响</a>
</body>

</html>

html轮播图布局

代码语言:html复制
<!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;
        }
        .box1 {
            position: absolute;
            top: 300px;
            width: 200px;
            height: 200px;
            background-color: pink;
        }
        .box2 {
            display: none;
            position: relative;
            width: 600px;
            height: 300px;
            background-color: skyblue;
        }

        .tb_promo {
            position: relative;
            width: 520px;
            height: 280px;
            background-color: blueviolet;
            margin:  100px auto;
        }

        .tb_promo img {
            width: 520px;
            height: 280px;
        }

        
        
        .tb_promo .prev,
        .tb_promo .next {
            position: absolute;
            top: 50%;
            margin-top: -15px;
            width: 20px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            background-color: rgba(0, 0, 0, .5);
            text-decoration: none;
            color: #fff;
        }

        .tb_promo .prev {
            left: 0;
            border-top-right-radius: 15px;
            border-bottom-right-radius: 15px;
        }
        
        .tb_promo .next {
            right: 0;
            border-top-left-radius: 15px;
            border-bottom-left-radius: 15px;
        }

        .tb_promo .pro_nav {
            position:absolute;
            left: 50%;
            bottom: 15px;
            margin-left: -35px;
            width: 70px;
            height: 13px;
            background: rgba(255, 255, 255, .3);
            border-radius: 7px;
        }

        .pro_nav li {
            float: left;
            list-style: none;
            width: 8px;
            height: 8px;
            background-color: #fff;
            margin: 3px;
            border-radius: 50%;
        }



    </style>
</head>
<body>
    <div class="box2">
        <div class="box1"></div>
    </div>

    <div class="tb_promo">
        <img src="1000.png" alt="">
        <a href="#" class="prev">&lt;</a>
        <a href="#" class="next">&gt;</a>
        <ul class="pro_nav">
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>

    </div>
</body>
</html>

html小三角

代码语言:txt复制
<!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>
        .box {
            width: 0;
            height: 0;
            border: 50px solid transparent;
            border-left: 50px solid pink;
        }

        .sanjiao {
            position: relative;
            width: 200px;
            height: 200px;
            background-color: antiquewhite;
        }

        span {
            position: absolute;
            /* border-width的两倍; */
            top: -20px;  
            right: 15px;
            width: 0;
            height: 0;
            font-size: 0;
            line-height: 0;
            border: 10px solid transparent;
            border-bottom-color: red;
        }

    </style>
</head>
<body>
    <div class="box"></div>
    <div class="sanjiao">
        <span></span>
    </div>
</body>
</html>

0 人点赞