Semantic Ui 菜单栏

使用 menu 创建菜单栏:

注意和 siderbar menu 的区别

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="http://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/semantic-ui/2.2.7/semantic.min.js"></script>
<link href="http://cdn.staticfile.org/semantic-ui/2.2.7/semantic.min.css" rel="stylesheet">
<style media="screen">
body {
padding: 20px;
}
</style>
<script>
$(document).ready(function() {
// 鼠标放到 dropdown 时显示下拉菜单,默认只有点击后才显示
$('.dropdown.item').dropdown({
on: 'hover'
});
});
</script>
</head>
<body>
<div class="ui inverted menu">
<div class="header item">Brand</div>
<div class="active item">Home</div>
<a class="item">Vitae</a>
<div class="ui dropdown item" tabindex="0">
Dropdown<i class="dropdown icon"></i>
<div class="menu" tabindex="-1">
<div class="item">Action</div>
<div class="item">Another Action</div>
<div class="item">Something else here</div>
<div class="divider"></div>
<div class="item">Separated Link</div>
<div class="divider"></div>
<div class="item">One more separated link</div>
</div>
</div>
<div class="right menu">
<div class="item">
<div class="ui transparent inverted icon input">
<i class="search icon"></i>
<input type="text" placeholder="Search">
</div>
</div>
<a class="item">Login</a>
</div>
</div>
</body>
</html>