Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make fixed top menu in Semantic-UI not cover content

I have a problem with my fixed-top menu in semantic-ui. It's covering a header element, which says "This is Stoga Hub". I don't think javascript or jQuery will do anything to help. I've tried messing around with margin-top/bottom for the menu and header elements and it worked, but I know my code will become really messy if I have to adjust the margin-top/bottom on every single webpage. I apologize if this has a really simple answer, I'm still very new to website building. Thank you all for your help.

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>
like image 964
Rich Avatar asked Mar 20 '16 02:03

Rich


People also ask

Is Semantic UI customizable?

Semantic provides several ways to modify UI elements. For big projects that rely on building a personalized brand-aware visual language, site themes allow you to modify the underlying variables powering Semantic UI, as well as specify alternative overriding css.

Is Semantic UI react responsive?

Both React and Semantic UI luckily make responsive design relatively easy with built-in components.

Is Semantic UI free?

Semantic UI is a free open source project already used in multiple large scale production environments.

What font does semantic UI use?

Semantic includes a complete port of Font Awesome 5.0. 8 designed by the FontAwesome team for its standard icon set.


1 Answers

I think that the easiest way might be padding-top:

.main.container {
    padding-top: 100px;
}

JS Fiddle link

like image 118
Timo Avatar answered Nov 15 '22 22:11

Timo