html - 不处理此代码的顶级属性

标签 html css

在下面的代码中,id“#bad”内的 top 属性没有任何效果,任何人都可以帮助我。当我将它与
一起使用时,它产生了一些效果 其他一些代码。 html代码:

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="rise.css">
    </head>
    <body>
        <div id="good">
            <div id="vahid">
                <div id="one">

                    <img src="image1.jpg"  id="boom"><br><br><br><br><br>
                    <!--button-->
                    <img src="button.jpg" id="button"><br><br><br><br>
                    <!--icons-->
                        <span class="local">
                            <img src="img.jpg">
                            <img src="img1.jpg">
                            <img src="img2.jpg">
                            <img src="img3.jpg">
                        </span><br><br><br><br>
                        <span class="local">
                            <img src="img4.jpg">
                            <img src="img5.jpg">
                            <img src="img6.jpg">
                            <img src="img7.jpg">
                        </span>
                </div>
            </div>
            <div id="isnani">
                 <div id="third">
                    <p >
                        <span class="fourth">Dashboard</span>      
                        <span class="fifth">  + New</span>
                    </p>
                    <!--<p class="fourth">&nbsp;</p>
                    <p id="fort"><input type="text" placeholder="search your project here..." ></p>
                    <div id="jump"><img  src="search.jpg" height="20px" width="10px"></div>-->

                    <p id="sixth">    Welcome to Flatkit</p>
                    <p id="seventh"> Bootstrap 4 Web App Kit With Angular js</p>

                </div>
            </div>
        </div>
        <div id="bad">
        </div>
    </body>
</html>

样式:

#good{
    width: 100%;
    height: 100%;
}
#bad{
    width: 15%;
    height: 100%;
    background-color: #023b3b;
    top:-80%;
}
#vahid{
    float: left;
    width: 7%;
    height: 100%;
    background-color: #023b3b;
}
#isnani{
    float: left;
    width: 93%;
    height: 100%;
    background-color: bisque;
}
#one {
  display:block;
  background-color: #023b3b;
   /* width:60px;
    height: 867px;*/
}
#boom{
    margin-top: 30%;
    height: 5%;
    width: 35%;
    float: left;
    padding-left: 20px;


}
.local img {
    height: 2.5%;
    width:30%;
    margin :10px 0px 10px 20px;
}

/*isnani starts here*/
#third{  float:left;
    width:100%;
     height: 15%;
    border-color:white; 
border-style : solid;
background-color : white;

}
.fourth{
    margin-left: 2%;
    margin-top: 5%;
    font-family: sans-serif;

}
.fifth{
    color: #808080;
    font-size: 80%;
    font-weight: 800;
    font-family: arial,sans-serif;
    margin-left: 1%;

}
#sixth{
     font-family: sans-serif;
     font-size:150%;
    color:#666666;
    margin-top: 4%;
    margin-left: 2%;
    /*top: -2%;/
   /* line-height: 3%; */


}
#seventh{
    position: absolute;
     top: 11%;
    color: #808080;
    font-family: sans-serif;
    font-size: 80%;
    margin-left: 1.8%;
    margin-top: 1.5%;

    /*line-height: 3%;*/

}
#fort{
    float: right;
    margin-top: -65px;
    margin-right: 80px;
}

#button{
    margin-left: 80%;
    width: 20%;
    hyphens: 20%;
}

在上面的代码中,id "#bad"中的 top 属性没有任何作用,任何人都可以帮助我。当我将它与
一起使用时,它产生了一些效果 一些其他代码。

最佳答案

要使属性 top/bottom/left/right 生效,元素必须非静态定位- 位置相对/绝对/固定

将位置应用于您的#bad

关于html - 不处理此代码的顶级属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38916815/

相关文章:

javascript - 是否可以在拖动小元素时避免在 CSS 光标类型之间切换?

javascript - 下拉菜单的 <div> 在 Chrome 中不可见

javascript - 如何在窄视口(viewport)上删除 jquery scrollfix 类

html - 如何在 HTML 中用多种颜色突出显示文本的不同部分

javascript - 在javascript中读取n个数字并计算列表中的+ve、-ve数字和零

javascript - GPA计算器,如何将字母输入变成数字

html - CSS 固定 div 并 overflow hidden

html - 跨浏览器自定义复选框

css - 了解 z-index 堆叠顺序

jquery - 如何绘制响应形状