简体   繁体   English

Semantic-ui菜单对齐?

[英]Semantic-ui menu alignment?

I am developing a website using semantic. 我正在使用语义开发一个网站。 I want to place my menu bar at Top of the website. 我想把我的菜单栏放在网站的顶部。 I tried the below code. 我尝试了下面的代码。 But it is not placing my Menu bar at the top. 但它不是将我的菜单栏放在顶部。 I see some space on top as well left side. 我看到顶部和左侧都有一些空间。 I don't want this. 我不想要这个。 Any one help me to fix this issue?? 任何人帮我解决这个问题?

在此输入图像描述

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>php userlogin tutorial</title>
<link rel="stylesheet" href="css/semantic.min.css">
<link rel="stylesheet" href="css/tab.min.css">
<script src="js/jquery.js"></script>
<script src="js/semantic.min.js"></script>
<script src="js/tab.min.js"></script>   
</head>
<body>
<nav class="ui menu">
    <a class="active green item">
        <i class="home icon"></i>Home
    </a>
    <a class="red item">
        <i class="user icon"></i> About us
    </a>
    <a class="blue item">
        <i class="photo icon"></i> Gallery
    </a>
</nav>
</body>
</html>

Not sure if this was available back then, but now (I'm currently using version 2.1.8 and I'm not sure when it was added) you can use 不知道当时是否可以使用,但现在(我目前正在使用2.1.8版,我不确定它何时添加)你可以使用

<div class="ui top fixed menu">
   ...
</div>

No need for custom css 不需要自定义CSS
http://semantic-ui.com/collections/menu.html#fixed http://semantic-ui.com/collections/menu.html#fixed

Add some custom CSS for that: 为此添加一些自定义CSS:

.menu-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
}

And use the class in HTML: 并使用HTML中的类:

<nav class="ui menu menu-top">
  ...
</nav>

JSFIDDLE 的jsfiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM