美文网首页
2022-06-22 模仿百度热搜列表纯静态css练习

2022-06-22 模仿百度热搜列表纯静态css练习

作者: 玲珑花 | 来源:发表于2022-06-22 21:33 被阅读0次
image.png
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            * {
                padding: 0;
                margin: 0;
                box-sizing: border-box;
            }
            body{
                padding-top: 40px;
                padding-left: 40px;
                background-color: #e8e8e8;
            }

            a {
                display: flex;
                justify-content: center;
                color: #333;
            }

            ul {
                list-style: none;
                width: 360px;
                font-size: 14px;
                padding: 10px;
                background-color: white;
            }

            ul li {
                position: relative;
                min-height: 38px;
                margin-bottom: 10px;
            }

            ul li img {
                border-radius: 8px;
                height: 0px;
                width: 340px;
                transition: all 0.5s;
                
            }

            ul li:nth-child(1) img {
                width: 340px;
                height: auto;
            }

            ul li .title {
                position: absolute;
                width: 100%;
                bottom: 2px;
                padding-left: 26px;
                display: flex;
                justify-content: space-between;
                padding-right: 10px;
            }

            ul li .top {
                width: 20px;
                height: 20px;
                bottom: 0px;
                left: -2px;
                border-radius: 0 8px 0 8px;
                background-color: #FF455B;
                display: block;
                position: absolute;
                text-align: center;
                color: white;
            }

            ul li:nth-child(1) .title {
                display: flex;
                justify-content: flex-start;
                color: white;
            }



            ul li:nth-child(2) span {
                color: red;
            }

            ul li:nth-child(3) span {
                color: orange;
            }

            ul li:nth-child(4) span {
                color: coral;
            }

            ul li .hot,
            ul li .new {
                background-color: orange;
                border-radius: 2px;
                padding: 0px 2px;
                color: white;
            }

            ul li .new {
                background-color: #ff455b;
            }
            
            ul li a:hover img{
                height: 130px;
                transform: translate(0,0,0);
            }
            ul li a:hover .title{
                color: white
            }
            ul li a .index{
                width: 20px;
                height: 20px;
                display: inline-block;
                text-align: center;
                position: absolute;
                left: 0;
            }
            ul li a:hover .index{
                color: white;
                width: 20px;
                height: 20px;
                display: inline-block;
                border-radius: 0 8px 0 8px;
                background-color: red;
                text-align: center;
                position: absolute;
                left: 0;
            }
            ul li:nth-child(3) a:hover .index{
                background-color: orange;
            }
            ul li:nth-child(4) a:hover .index{
                background-color: greenyellow;
            }
        </style>
    </head>
    <body>
        <ul>
            <li>
                <a
                    href="https://fyb-1.cdn.bcebos.com/hotboard_img/dab40dc5fe61ff73fc6ab832341d935f?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <img
                        src="https://fyb-1.cdn.bcebos.com/hotboard_img/dab40dc5fe61ff73fc6ab832341d935f?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <span class="top">H</span>
                    <div class="title">
                        强化气象预警和应急响应联动
                    </div>
                </a>
            </li>
            <li>
                <a
                    href="https://fyb-1.cdn.bcebos.com/hotboard_img/21bc82f7bb16218cb8877c3a0f2b085e?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <img
                        src="https://fyb-1.cdn.bcebos.com/hotboard_img/21bc82f7bb16218cb8877c3a0f2b085e?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <div class="title">
                        <div><span class="index">1</span>媒体:公布打人案受害人近况不宜迟1</div>
                        <div class="hot">热</div>
                    </div>
                </a>

            </li>
            <li>
                <a
                    href="https://fyb-1.cdn.bcebos.com/hotboard_img/21bc82f7bb16218cb8877c3a0f2b085e?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <img
                        src="https://fyb-1.cdn.bcebos.com/hotboard_img/21bc82f7bb16218cb8877c3a0f2b085e?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <div class="title">
                        <div><span class="index">2</span>媒体:公布打人案受害人近况不宜迟2</div>
                        <div class="new">新</div>
                    </div>
                </a>

            </li>
            <li>
                <a
                    href="https://fyb-1.cdn.bcebos.com/hotboard_img/21bc82f7bb16218cb8877c3a0f2b085e?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <img
                        src="https://fyb-1.cdn.bcebos.com/hotboard_img/21bc82f7bb16218cb8877c3a0f2b085e?x-bce-process=image/resize,m_fill,w_732,h_272">
                    <div class="title">
                        <div><span class="index">3</span> 媒体:公布打人案受害人近况不宜迟3</div>
                    </div>
                </a>

            </li>
        </ul>
    </body>
</html>

相关文章

网友评论

      本文标题:2022-06-22 模仿百度热搜列表纯静态css练习

      本文链接:https://www.haomeiwen.com/subject/kjnuvrtx.html