纯CSS制作简洁的垂直导航

2016-02-19 17:44 16 1 收藏

给自己一点时间接受自己,爱自己,趁着下午茶的时间来学习图老师推荐的纯CSS制作简洁的垂直导航,过去的都会过去,迎接崭新的开始,释放更美好的自己。

【 tulaoshi.com - Web开发 】

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; }

来源:https://www.tulaoshi.com/n/20160219/1615921.html

延伸阅读
标签: Web开发
经过今天一翻改进,终于找出了解决DIV垂直居中的办法。 !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" html xmlns="http://www.w3.org/1999/xhtml" head meta http-equiv="Content-Type" content="text/ht...
标签: Web开发
在上面一节我们讲到的是垂直的导航.但是大多网站用的还是横向的导航,那么就来跟我学下横向导航是如何实现的. 要怎么实现下面的效果.只要在列表项之间避免换行就行了,所以要把li转换为内联. HTML和CSS代码如下: ============================= !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    ...
标签: Web开发
除非你的网站只有一页,不然你一定会用的导航的.事实上,导航在网页设计中是最重要部分之一.你要用很多时间去考虑如何让浏览者更容易访问你的网站. 在以前做网站导航时,往往依赖于图像,表格,和javascript.而这些都严重的影响了网站的可访问性和可使用性.如果在一个缺乏支持javascript的用户,那么你的网站导航将无算正常的显示.比如说一个用户...
标签: Web开发
网页制作,用CSS实现图片垂直居中方法 !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"style type="text/css"!--body {margin:0;padding:0}div {width:500px;height:500px;line-height:500px;border:1px solid #ccc;overflow:h...
标签: Web开发
用Table布局可以很容易的实现文字和图片的垂直居中,但是在div的布局中呢,要实现定高容器里面的内容的垂直居中不是太简单的事情。 在DOM标准中 在IE中 综合 #boxOuter {     display:table;     height:300px;     width:500px;     border:solid 1px black;   &n...

经验教程

364

收藏

19
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部