为什么 .登录类,有我不能的边距顶部,将其更改为更小的尺寸?

  • 本文关键字:登录 有我 不能 顶部 html css
  • 更新时间 :
  • 英文 :


在此代码中,我想设置.登录类,更小,虽然我设置了边距顶部,为零,但它没有设置在页面顶部附近。我能做什么?为什么通过设置此分区的边距顶部,此div不设置,靠近页面顶部?其他事情可以吗?其他元素可以正常工作。

body {
margin: 0px;
direction: rtl;
}
@font-face {
src: url('../fonts/IRANSansWeb.eot'), url('../fonts/IRANSansWeb.woff'), url('../fonts/IRANSansWeb.woff2'), url('../fonts/IRANSansWeb.ttf');
font-family: "IranSans";
}
header {
width: 100%;
min-height: 700px;
height: auto;
overflow: auto;
background-color: #007bff;
}
nav {
margin-top: 0px;
height: 50px;
}
nav ul {
width: 60%;
height: 60px;
margin: 0px auto;
border: 2px solid black;
display: inline-block;
}
.Logo {
width: 160px;
height: 50px;
margin-left: 0px;
margin-right: 30px;
margin-bottom: 0px;
display: inline-block;
}
.Logo img {
width: 100%;
height: 100%;
}
.LogIn {
width: 140px;
height: 50px;
display: inline-block;
margin-right: 130px;
margin-top: 0px;
font-family: "IranSans";
border-radius: 5px;
background-color: #00d363;
}
.LogInA {
width: 100%;
height: 100%;
border: 5px;
color: #fff;
display: inline-block;
text-decoration: none;
text-align: center;
line-height: 50px;
}
.LogInA:hover {
border-radius: 5px;
background-color: #007bff;
color: #00d363;
border: 1px solid #00d363;
}
<body>
<header>
<nav>
<div class="Logo"><img src="Content/img/logo.png" alt="جاب بورد"></div>
<ul>
</ul>
<div class="LogIn">
<a class="LogInA" href="#">ارسال شغل</a>
</div>
</nav>

</header>
</body>

尝试将display: flex;添加到导航中

你应该使用:display:flex; justify-content: center;到您的导航,您还应该删除高度并使用:移动版本中的flex-direction:column;

相关内容

最新更新