Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semantic UI centered non-fluid menu?

I have two menus, one is fixed to the bottom and another fixed to the top. My problem is two-fold. I want them to appear at the center of the screen and only be the width of their content (instead of being fluid, as per default).

I have found nothing in the documentation to indicate that this is possible, so presumably the solution is to modify it with CSS?

Any help would be greatly appreciated.

like image 563
Nathan McCallum Avatar asked Apr 25 '15 04:04

Nathan McCallum


People also ask

How do you center in semantic UI?

Semantic-UI Grid is used to harmonize the negative space in our webpage layout. Varying Grid Centering Content is used to center the columns inside the grid. If the row does not take all the sixteen grid columns space then we can center the columns using centered class.

How do I center text in semantic UI?

To change the text alignment of the semantic UI card, we use the “center/left/right aligned” class in the section of the card where we want the alignment.

What is semantic UI used for?

What is Semantic UI? Semantic UI is a front-end development framework similar to bootstrap designed for theming. It contains pre-built semantic components that helps create beautiful and responsive layouts using human-friendly HTML.


2 Answers

Use the semantic ui class "compact" for your UI menus to adjust to content, and then use grids and columns for center alignment. So for example:

<div class="ui centered grid">
    <div class="center aligned column">
        <div class="ui compact menu">
          <a class="active item">
            <i class="home icon"></i> Home
          </a>
          <a class="item">
            <i class="mail icon"></i> Messages
          </a>
        </div>        
    </div>
</div>

JSFiddle Link: http://jsfiddle.net/pLskpufp/2/

like image 133
MTran Avatar answered Oct 16 '22 17:10

MTran


You can also just use a center aligned container:

<div class="ui center aligned container">
    <div class="ui compact menu">
        <a class="active item">
            <i class="home icon"></i> Home
        </a>
        <a class="item">
            <i class="mail icon"></i> Messages
        </a>
    </div>        
</div>

JSFiddle Link: http://jsfiddle.net/377v6ect/1/

like image 3
Bonnici Avatar answered Oct 16 '22 18:10

Bonnici