gpt4 book ai didi

html - 如何为div标签添加CSS

转载 作者:行者123 更新时间:2023-11-28 08:18:00 28 4
gpt4 key购买 nike

我想显示“rest”div 标签顶部的 div 标签。'Rest' div 标签就像容器。我想在左侧显示菜单,并想在 rest 标签的 margin-top 上显示“heading”div 标签。

在我的布局中,我用绿色绘制了“菜单”div,这是正确的。我想在我用红色框标记的位置显示 div 标签“标题”。但我的问题是现在它显示在底部我把它画在蓝色的盒子里。

layout

.heading{
float:left;
margin-top:0px;
margin-left:170px;
height:25px;
width:79%;
background-color:#15317E;

}
.rest {
height: 685px;
background: -o-linear-gradient(bottom, #e5e3e3 5%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e5e3e3), color-stop(1, #ffffff));
background: -moz-linear-gradient(center top, #e5e3e3 5%, #ffffff 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr="#e5e3e3", endColorstr="#ffffff");
background: -o-linear-gradient(top, #e5e3e3, ffffff);
background-color: #e5e3e3;
border: 1px solid #f9f2f2;
border-width: 0px 0px 0px 0px;
border-radius: 0px 0px 10px 10px;
text-align: left;
padding: 0px 7px;
}
.sidemenu {
float: left;
margin-top: 150px;

height: 250px;
width: 150px;
border: 1px solid #f9f2f2;
border-radius: 10px;
}
.content {
border-left: thick solid #f9f2f2;
}
hr {
margin: 0;
margin-left:170px;
width: 1px;
height: 660px;
border:0;
background: #fff;
}
.menu{
height: 45px;
width: 150px;
text-align:left;
margin-left:2px;

background: -o-linear-gradient(bottom, #e5e3e3 5%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e5e3e3), color-stop(1, #ffffff));
background: -moz-linear-gradient(center top, #e5e3e3 5%, #ffffff 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr="#e5e3e3", endColorstr="#ffffff");
background: -o-linear-gradient(top, #e5e3e3, ffffff);
background-color: #e5e3e3;
border: 1px solid #f9f2f2;
border-width: 0px 0px 0px 0px;
border-radius: 0px 0px 10px 10px;
text-align: left;
padding: 0px 7px;
}
  <div class="rest">
<div class="side">
<div class="sidemenu">
<div class="1 menu">
<a href="admin_dashboard.php" class="astext">Profile</a>
</div> <!--End of menu1 -->
<div class="2 menu">
<a href="clients.php" class="astext">Clients</a>
</div> <!--End of menu 2-->
<div class="3 menu">
<a href="employees.php" class="astext">Employees</a>
</div> <!--End of menu 3-->
<div class="menu 4">
<a href="admin_file_view.php" class="astext">Documents</a>
</div> <!--End of menu 4-->
</div> <!--End of side menu -->
</div> <!--End of side div -->
<hr>
<div class="heading" >

</div> <!-- End of heading div -->
<div class="content">

</div> <!--End of content -->
</div> <!--End of rest div -->

最佳答案

替换您的 .heading、hr 并添加新的 css .side 类。我认为它会得到解决。

.heading{
float: left;
margin-top: 0px;
margin-left: 0px;
height: 25px;
width: 66%;
background-color: #15317E;

}
.side{
width: 33%;
float: left;
display: inline-block;
}

hr {
margin: 0;
width: 1px;
height: 660px;
border: 0;
background: #fff;
float: left;
}

Demo

关于html - 如何为div标签添加CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28894731/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com