纯CSS制作简洁的垂直导航

css

以下是引用片段:
/* common styling */
/* set up the overall width of the menu div, the font and the margins */

.menu {
font-family: arial, sans-serif; 
width:750px; 
margin:0; 
margin:50px 0;
}
/* remove the bullets and set the margin and padding to zero for the unordered list */
.menu ul {
padding:0; 
margin:0;
list-style-type: none;
}
/* 浮动列表,因此可以让items在一行上,并且他们的相对定位可以让下面的列表显示在正确的位置上*/
.menu ul li {
float:left; 
position:relative;
}
/* style the links to be 104px wide by 30px high with a top and right border 1px solid white. 
Set the background color and the font size. */
.menu ul li a, .menu ul li a:visited {
display:block; 
text-align:center; 
text-decoration:none; 
width:104px; 
height:30px; 
color:#000; 
border:1px solid #fff;
border-width:1px 1px 0 0;
background:#c9c9a7; 
line-height:30px; 
font-size:11px;
}
/* make the dropdown ul invisible */
.menu ul li ul {
display: none;
}

/* specific to non IE browsers */
/* set the background and foreground color of the main menu li on hover */
.menu ul li:hover a {
color:#fff; 
background:#b3ab79;
}
/* make the sub menu ul visible and position it beneath the main menu list item */
.menu ul li:hover ul {
display:block; 
position:absolute; 
top:31px; 
left:0; 
width:105px;
}
/* style the background and foreground color of the submenu links */
.menu ul li:hover ul li a {
display:block; 
background:#faeec7; 
color:#000;
}
/* style the background and forground colors of the links on hover */
.menu ul li:hover ul li a:hover {
background:#dfc184; 
color:#000;
}

时间: 2024-08-03 12:08:03

纯CSS制作简洁的垂直导航的相关文章

纯CSS制作简洁的垂直网站导航条

css|导航 CSS代码 以下是引用片段:/* common styling */ /* set up the overall width of the menu div, the font and the margins */ .menu { font-family: arial, sans-serif;  width:750px;  margin:0;  margin:50px 0; } /* remove the bullets and set the margin and padding

CSS+DIV设计实例:纯CSS制作下拉导航菜单

css|菜单|设计|下拉 纯CSS制作的下拉导航菜单-这是一个老外的作品,基本上全是用CSS+HTML写出来的,值得大家学习 以下是引用片段:<style type="text/css">.menu {font-family: verdana, sans-serif; width:750px; position:relative; font-size:0.85em;padding-bottom:250px;}.menu ul {padding:0; margin:0;lis

纯CSS制作二级导航

原文:纯CSS制作二级导航 一.问题描述 做一个类似校园网首页,主要是导航栏的设置,ul默认纵向排列,如何横向排列,同时去掉圆点. 二.问题解决 2.1 先写导航条 用两个ul嵌套,一个ul是横向导航条,另一个是每个小项目下连一个竖向的ul. 1 <ul id="nav_ul"> 2 <li> 3 <a href="#">首页</a> 4 <ul class="nav_ul_ul"> 5

一个用纯CSS制作的网页下拉菜单

网页特效代码实例:一个用纯CSS制作的网页下拉菜单. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"[ <!ELEMENT a (#PCDATA | table)* > ]><html xmlns="http://www.w3.org/1999/xhtml" xml:lang

纯CSS+Div 经典下拉导航菜单

提示:您可以先修改部分代码再运行 纯CSS+Div 经典导航菜单 Home Single Level Dropdown Dropdown One Dropdown Two Dropdown Three Dropdown Four Dropdown Five Dropline Dropline One Dropline Two Dropline Three Dropline Four Flyout Flyout One Flyout Two Flyout Three Flyout Four Fly

css实现漂亮的垂直导航样式

幻灯片滑动切换的时候,需要做个切换的导航条,甚至很多的页面或者组件都用到导航条,本文结合实例将简单介绍使用CSS实现的垂直幻灯片导航样式效果. 漂亮的垂直导航样式 列表样式">  本文实例中收集了多种不同的导航样式,我们知道,滑动的幻灯片或者其他需要导航引导的组件,它们需要导航指示所在的当前滑块.本文实例中有多种非常有趣和来自不同灵感的导航样式,都是基于垂直幻灯片效果的,当然你也可以修改样式应用到你的项目中去. 这是我们实例中的一小段html结构: <section class=&q

纯CSS制作的网页中的lightbox效果

"Lightbox"是一个别致且易用的图片显示效果,它可以使图片直接呈现在当前页面之上而不用转到新的窗口.lightbox效果网络上有很多js版本的介绍.不过都下载一个lightbox的js小则几十K,大则上百K.如果你只是需要一个类似Lightbox的效果,这种百分之百纯CSS制造,不含js的办法倒是可以试试. 以下是引用片段:<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><ht

纯CSS制作的新闻网站中的文章列表

应用CSS制作的新闻网站中的文章列表:ul是html中的无序列表,li是列表中的列表项.如果没有CSS定义它的外观,它默认是显示成一列列表,并且它会存在项目符号(比如方块或实心的黑点)的列表内容.CSS网页布局中,除了新闻列表.链接运行ul.li制作以外,我们通常将菜单也用ul.li来实现. 以下是引用片段: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org

纯CSS制作的新闻网站中的文章列表_经验交流

应用CSS制作的新闻网站中的文章列表:ul是html中的无序列表,li是列表中的列表项.如果没有CSS定义它的外观,它默认是显示成一列列表,并且它会存在项目符号(比如方块或实心的黑点)的列表内容.CSS网页布局中,除了新闻列表.链接运行ul.li制作以外,我们通常将菜单也用ul.li来实现.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm