CSS Navigation Bar
Demo: Navigation Bars
Navigation Bars
Having easy-to-use navigation is important for any web site.
With CSS you can transform boring HTML menus into good-looking navigation bars.
Navigation Bar = List of Links
A navigation bar needs standard HTML as a base.
In our examples we will build the navigation bar from a standard HTML list.
A navigation bar is basically a list of links, so using the
- and
- elements makes perfect
sense:
例子
来试试吧 »Now let's remove the bullets and the margins and padding from the list:
例子
ul
{
list-style-type: none;
margin: 0;
padding: 0;
}来试试吧 »
例子 explained:
list-style-type: none; - Removes the bullets. A navigation bar
does not need list markers
Set margin: 0; and padding: 0;
to remove browser default settings
The code in the example above is the standard code used in both vertical, and horizontal navigation bars, which you will learn more about in the next chapters.
本文介绍如何使用CSS将简单的HTML列表转换为美观且易用的网站导航栏。通过去除列表符号并调整边距和填充,可以创建出适用于垂直或水平布局的导航栏。
412

被折叠的 条评论
为什么被折叠?



