weixin_53346076 2022-05-09 21:25 采纳率: 100%
浏览 16
已结题

无法设置多行,设置过后会在原来的位置

打算设置三行一行只放两张图的第一行设置以后,设置第二行和第三行的时候会直接覆盖在第一行的位置、新加一个ID选择器加上TOP属性也无法改变位置
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>期末</title>
        <link rel="stylesheet" href="css/QiMo.css">
    </head>
    <body>
        <div class="aa1">
            <div class="a1">
            <div class="a2">
                <a class="logo" href="#" title="英雄联盟官网">
                    <img src="img/logo.jpg" alt="英雄联盟" width="157px" height="60px">
                </a>
            </div>
            <div class="ul-1">
                <ul>
                    <li>
                        <a class="a1-1" href="#" title="游戏资料">
                            <span class="span-1">游戏资料</span>
                            <span class="span-2">GAME INFO</span>
                        </a>
                    </li>
                    <li>
                        <a class="a1-1" href="#" title="商城/合作">
                            <span class="span-1">商城/合作</span>
                            <span class="span-2">STORE</span>
                        </a>
                    </li>
                    <li>
                        <a class="a1-1" href="#" title="社区互动">
                            <span class="span-1">社区互动</span>
                            <span class="span-2">COMMUNITY</span>
                        </a>
                    </li>
                    <li>
                        <a class="a1-1" href="#" title="赛事官网">
                            <span class="span-1">赛事官网</span>
                            <span class="span-2">ESPORTS</span>
                        </a>
                    </li>
                    <li>
                        <a class="a1-1" href="#" title="自助系统">
                            <span class="span-1">自助系统</span>
                            <span class="span-2">SYSTEM</span>
                        </a>
                    </li>
                </ul>
            </div>
            </div>
            <!-- 视频背景 -->
            <div>
                <div class="video-center">
                    <video class="video-top" autoplay="autopaly" loop="loop" muted="1">
                        <source src="img/video.webm" type="video/webm">
                        <source src="img/video.mp4" type="video/mp4">
                    </video>
                </div>
            </div>
            <div id="jsz">
                <ol class="card-list">
                    <li>
                        <img src="img/虚空掠夺者.jpg" alt="">
                        <div class="up-1">
                            <a href="#"><h1>虚空掠夺者</h1></a>
                    </li>
                    <li>
                        <img src="img/傲之追猎者.jpg" alt="">
                        <div class="up-1">
                            <a href="#"><h1>傲之追猎者</h1></a>
                        </div>
                    </li>
                </ol>
            </div>
        </div>
    </body>
</html>


.aa1{
    height: 100%;
    height: 990px;
}
.a1{
    width: 100%;
    height: 78px;
    overflow: visible;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 11;
    background-color: black;
    position: fixed;
}
.a1-1{
    float: left;
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}
.a2{
    float: left;
    width: 167px;
    height: 60px;
    text-decoration: none;
}
.logo{
    float: left;
    width: 160px;
    height: 67px;
    margin-top: 10px;
    text-decoration: none;
}
a{
    text-decoration: none;
}
.ul-1{
    float: left;
    width: 55%;
    height: 78px;
    box-sizing: border-box;
    margin-left: 30px;
    padding-top: 16px;
    list-style: none;
    padding: 0px;
    margin: 0px;
}
li{
    float: left;
    list-style: none;
    list-style-position: outside;
    list-style-image: none;
    list-style-type: none;
    width: 20%;
    height: 78px;
    text-align: center;
}
.span-1{
    display: block;
    color: #fff;
    font-size: 18px;
    letter-spacing: 1px
}
.span-2{
    display: block;
    color: #aeaeae;
    font-size: 11px;
    margin-top: -1px;
    letter-spacing: 1px
}
.video-center{
    width: 1920px;
    height: 990px;
    display: block;
    position: absolute;
    top: 78px;
    left: 50%;
    margin-left: -960px;
    pointer-events: none;
    overflow: hidden;
    overflow-x: hidden;
    overflow-y: hidden;
    background-color: #aeaeae;
}
.video-top{
    pointer-events: none;
}


#jsz >.card-list{
    position: absolute;
    bottom: 0;
    top: 20%;
    /* flex布局让子元素水平排列 */
    display: flex; 
    width: 100%;
    height: 250px;
    list-style: none;
    justify-content: space-around;
    align-items: center;
    background-color: #aeaeae;
    
}
#jsz .card-list li {
    position: relative;
    /* 让每个li平分空间 */
    width: 490px;
    height: 250px;
    text-align: center;
      
    line-height: 10px;
    border-radius: 10px ;
    /* 隐藏遮罩层 */
    overflow: hidden;
}
#jsz .card-list li h1{
    margin: 0;/* 前面的样式污染了 ,清除外边距*/
    line-height: 200px;
}
#jsz .card-list li img{
    width: 490px;
    height: 250px;
    border-radius: 10px ;
      
    
}
/* 设置遮罩层的样式 */
#jsz .card-list li .up-1{
    position: absolute;
    top: 250px;
    left: 0;
    width: 490px;
    height: 250px;
    background-color: rgb(0, 0, 0,.4);
    border-radius: 10px ;
    transition: top 0.6s ease ;
    
}
/* hover效果 */
#jsz .card-list li:hover .up-1{
    top: 0;
      
}
#jsz .card-list li:hover img{
    transform: scale(1.3);
    transition: 1s;
}




无法移动位置
设置性的Id属性也没用
让他的三个盒子能平行排开而不是重叠在一起
  • 写回答

1条回答 默认 最新

  • 前端陈皮喵 2022-05-10 14:35
    关注

    题主可以再确认一下需求吗,是哪三个盒子重叠在一起了,我是直接复制了你上面的代码

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 11月17日
  • 已采纳回答 11月9日
  • 创建了问题 5月9日

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭