我的semantic-ui中的固定顶级菜单有问题。它覆盖了一个标题元素,上面写着“这是Stoga Hub”。我不认为javascript或jQuery会做任何事情来帮助。我已经尝试使用margin-top / bottom来处理菜单和标题元素并且它有效,但我知道如果我必须在每个网页上调整margin-top / bottom,我的代码将变得非常混乱。如果这有一个非常简单的答案我很抱歉,我对网站建设仍然很陌生。谢谢大家的帮助。
var main = function() {
$('.ui.dropdown').dropdown({
on: 'hover'
});
$('.item').click(function() {
$('.item').removeClass('active');
$(this).toggleClass('active');
});
$('.ui.checkbox')
.checkbox();
};
$(document).ready(main);
.main {
height: 600px;
background: linear-gradient(to right, #16a085, #2c3e50);
position: absolute;
/*margin-top: 78px;*/
}
.ui.header {
font-size: 65px;
}
body {
background-color: #ecf0f1;
color: white;
}
.segment {
background-position: 50% 50%;
margin: auto;
}
.menu {
padding-top: 8px;
padding-bottom: 8px;
color: maroon;
position: relative;
/*margin-bottom: 62px;*/
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Menu -->
<div class="ui large top fixed transparent menu">
<div class="ui container">
<a class="active item">"Logo"</a>
<div class="ui dropdown item">
<div class="text">Members</div>
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="http://tesd.net/stoga">CHS Website</a>
<a class="item" href="http://stogamusic.com">Stoga Music</a>
<a class="item" href="http://stoga.net">Stoga Library Index</a>
<a class="item" href="http://spoke.news">Spoke News</a>
</div>
</div>
<div class="ui dropdown item">
<div class="text">Clubs</div>
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="../Main%20Files/clubs.html">Club List</a>
<a class="item">Register a Club</a>
</div>
</div>
<div class="ui dropdown item">
<div class="text">Useful Stuff</div>
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="https://pinnacle.tesd.net/Pinnacle/PIV/Logon.aspx?ReturnUrl=%2fPinnacle%2fPIV%2fDefault.aspx">Pinnacle</a>
<a class="item" href="https://connection.naviance.com/family-connection/auth/login/?hsid=conestoga">Naviance</a>
</div>
</div>
<div class="ui dropdown item">
<div class="text">About</div>
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="../Main%20Files/whoWeAre.html">Who We Are</a>
<a class="item" href="../Main%20Files/Calendar.html">Calendar</a>
<a class="item" href="../Main%20Files/contact.html">Contact Us</a>
</div>
</div>
<div class="right menu">
<a class="item"><i class="sign in icon"></i>Login</a>
</div>
</div>
</div>
<div class="ui fluid main container">
<div class="segment">
<div class="ui container">
<h1 class="ui header">This is Stoga Hub</h1>
</div>
</div>
</div>
答案 0 :(得分:2)
答案 1 :(得分:1)
我看到你在主要上尝试了一个保证金顶部。尝试&#34;顶部:78px&#34;相反,因为它绝对定位。如果您的文章顶部始终有一个文本,您也可以尝试
.segment {
margin: 100px auto 0;
}
会在段的顶部添加额外的边距,因此文本不会被压在标题上。 (边距为&#34; auto&#34;仅在侧面工作,而不是顶部和底部。)您可以使用&#34; padding-top&#34;在.main或.segment中。