flex 小案例

2023-12-26 19:06:59
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="./01test小案例.css">
</head>
<style>
  
</style>
<body>
    <!-- 头部 -->
    <header class="page-header">
        <a href="">
        <img src="../images/logo4.png">
        </a>
        <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>
            <li><a href="">买写字楼</a></li>
        </ul>
    </header>
    <!-- 内容区 -->
    <div class="page-content">
        <div class="content-nav">
            <div class="item">
                <img src="../images/item1.png">
                <span>我的邮箱</span>
            </div>
            <div class="item">
                <img src="../images/item2.png">
                <span>我的邮箱</span>
            </div>
            <div class="item">
                <img src="../images/item3.png">
                <span>我的邮箱</span>
            </div>
            <div class="item">
                <img src="../images/item4.png">
                <span>我的邮箱</span>
            </div>
            <div class="item">
                <img src="../images/item5.png">
                <span>我的邮箱</span>
            </div>
        </div>
        
    </div>

    
</body>
</html>
* { 
    font-family: Arial; 
    font-size: 14px; 
    margin: 0; 
    padding: 0; 
    border: none; 
}
a { text-decoration: none; }
ul { list-style: none; }

html,body{
    width: 100%;
    height: 100%;
}
body{
    background-image: url(../images/bg.jpg) ;
    background-size: cover;
    background-repeat: no-repeat;
}

/* page header */
.page-header{
    height: 70px;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    align-items: center;
}
.page-header ul{
    display: flex;
}
.page-header li{
    color:#fff;
    border:1px solid #fff;
    border-radius: 8px;
    padding:10px;
    margin:0 10px
}
.page-header li a{
    color:#fff;
}

/* 内容区 */
.page-content{
   
    background-color: pink;
    height: calc(100vh - 70px);
    /* height: calc(100vh - 70px); */
    display: flex;
    align-items: center;
    justify-content: center;
}
.content-nav{
    display: flex;
    width: 1000px;
    height: 300px;
    background-color: aquamarine;
    justify-content: space-evenly;
    align-items: center;
    transition: 0.2s linear;

}
.content-nav .item{
    width: 180px;
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    color:#fff;
    transition: 0.2s linear;

  
}
.content-nav .item:hover{
    box-shadow:  0px 0px 20px black;
}

.page-content .content-nav .item:nth-child(1){
    background-color: #595CA8; ;
}
.page-content .content-nav .item:nth-child(2){
    background-color: #FF9D2E; ;
}
.page-content .content-nav .item:nth-child(3){
    background-color: #01A6DE; ;
}
.page-content .content-nav .item:nth-child(4){
    background-color: #015E91; ;
}
.page-content .content-nav .item:nth-child(5){
    background-color: #1DC128; ;
}

文章来源:https://blog.csdn.net/u014378108/article/details/135227356
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。