CSS使用圖片美化的漂亮菜單效果
發(fā)布時間:2015-09-28 16:47:35 作者:佚名
我要評論

這篇文章主要為大家介紹了CSS使用圖片美化的漂亮菜單效果,涉及css背景圖片動態(tài)設(shè)置的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了CSS使用圖片美化的漂亮菜單效果。分享給大家供大家參考。具體如下:
這里介紹的這個菜單很漂亮,因為每個菜單項都是調(diào)用的圖片,感覺這個菜單有點華而不實,畢竟菜單太多會影響網(wǎng)頁加載,一個菜單也沒有必要為了好看而犧牲太多,根據(jù)你的需要使用哦。
運行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/css-pic-cha-style-menu-demo/
具體代碼如下:
復(fù)制代碼
代碼如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用圖片美化的CSS菜單</title>
<style>
body{background:#fff url(images/bkg_page.png);background-repeat:repeat-x;padding:0;margin:0;font-family:'Verdana';font-size:12px;color:#7f8991}
#header{margin:108px 0 0 100px}
#header em{display:none}
#header ul{width:100%;float:left;padding:0;margin:0;list-style-type:none}
#header li{float:left;padding:0;margin:0;display:inline}
#header li a{display:block;height:46px}
#header li a.home{background:url(images/menu_01.png) no-repeat left top;width:52px}
#header li a.homeActive{background:url(images/menu_01.png) no-repeat left bottom;width:52px}
#header li a.gallery{background:url(images/menu_02.png) no-repeat left top;width:60px}
#header li a.galleryActive{background:url(images/menu_02.png) no-repeat left bottom;width:60px}
#header li a.resources{background:url(images/menu_03.png) no-repeat left top;width:76px;margin:0;padding:0}
#header li a.resourcesActive{background:url(images/menu_03.png) no-repeat left bottom;width:76px}
#header li a.submit{background:url(images/menu_04.png) no-repeat left top;width:97px}
#header li a.submitActive{background:url(images/menu_04.png) no-repeat left bottom;width:97px}
#header li a.feed{background:url(images/menu_05.png) no-repeat left top;width:68px}
#header li a.feedActive{background:url(images/menu_05.png) no-repeat left bottom;width:68px}
#header li a.about{background:url(images/menu_06.png) no-repeat left top;width:52px}
#header li a.aboutActive{background:url(images/menu_06.png) no-repeat left bottom;width:52px}
#header li a.blog{background:url(images/menu_10.png) no-repeat left top;width:51px}
#header li a.blogActive{background:url(images/menu_10.png) no-repeat left bottom;width:51px}
#header li a.contact{background:url(images/menu_07.png) no-repeat left top;width:64px}
#header li a.contactActive{background:url(images/menu_07.png) no-repeat left bottom;width:64px}
#header li a:hover{background-position:left bottom}
</style>
</head>
<body>
<div id="header">
<ul>
<li><a class="homeActive" href="#"><em>home</em></a></li>
<li><a class="gallery" href="#"><em>gallery entries</em></a></li>
<li><a class="resources" href="#"><em>resources</em></a></li>
<li><a class="submit" href="#"><em>submit a site</em></a></li>
<li><a class="feed" href="#"><em>our feed</em></a></li>
<li><a class="blog" href="#"><em>blog</em></a></li>
<li><a class="about" href="#"><em>about</em></a></li>
<li><a class="contact" href="#"><em>contact</em></a></li>
</ul>
</div>
</body>
</html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用圖片美化的CSS菜單</title>
<style>
body{background:#fff url(images/bkg_page.png);background-repeat:repeat-x;padding:0;margin:0;font-family:'Verdana';font-size:12px;color:#7f8991}
#header{margin:108px 0 0 100px}
#header em{display:none}
#header ul{width:100%;float:left;padding:0;margin:0;list-style-type:none}
#header li{float:left;padding:0;margin:0;display:inline}
#header li a{display:block;height:46px}
#header li a.home{background:url(images/menu_01.png) no-repeat left top;width:52px}
#header li a.homeActive{background:url(images/menu_01.png) no-repeat left bottom;width:52px}
#header li a.gallery{background:url(images/menu_02.png) no-repeat left top;width:60px}
#header li a.galleryActive{background:url(images/menu_02.png) no-repeat left bottom;width:60px}
#header li a.resources{background:url(images/menu_03.png) no-repeat left top;width:76px;margin:0;padding:0}
#header li a.resourcesActive{background:url(images/menu_03.png) no-repeat left bottom;width:76px}
#header li a.submit{background:url(images/menu_04.png) no-repeat left top;width:97px}
#header li a.submitActive{background:url(images/menu_04.png) no-repeat left bottom;width:97px}
#header li a.feed{background:url(images/menu_05.png) no-repeat left top;width:68px}
#header li a.feedActive{background:url(images/menu_05.png) no-repeat left bottom;width:68px}
#header li a.about{background:url(images/menu_06.png) no-repeat left top;width:52px}
#header li a.aboutActive{background:url(images/menu_06.png) no-repeat left bottom;width:52px}
#header li a.blog{background:url(images/menu_10.png) no-repeat left top;width:51px}
#header li a.blogActive{background:url(images/menu_10.png) no-repeat left bottom;width:51px}
#header li a.contact{background:url(images/menu_07.png) no-repeat left top;width:64px}
#header li a.contactActive{background:url(images/menu_07.png) no-repeat left bottom;width:64px}
#header li a:hover{background-position:left bottom}
</style>
</head>
<body>
<div id="header">
<ul>
<li><a class="homeActive" href="#"><em>home</em></a></li>
<li><a class="gallery" href="#"><em>gallery entries</em></a></li>
<li><a class="resources" href="#"><em>resources</em></a></li>
<li><a class="submit" href="#"><em>submit a site</em></a></li>
<li><a class="feed" href="#"><em>our feed</em></a></li>
<li><a class="blog" href="#"><em>blog</em></a></li>
<li><a class="about" href="#"><em>about</em></a></li>
<li><a class="contact" href="#"><em>contact</em></a></li>
</ul>
</div>
</body>
</html>
希望本文所述對大家的css網(wǎng)頁設(shè)計有所幫助。
相關(guān)文章
CSS實現(xiàn)自動變?yōu)榇髮懙淖赃m應(yīng)漂亮菜單效果
這篇文章主要為大家介紹了CSS實現(xiàn)自動變?yōu)榇髮懙淖赃m應(yīng)漂亮菜單效果,涉及css中text-transform屬性設(shè)置uppercase實現(xiàn)大寫轉(zhuǎn)換的相關(guān)技巧,需要的朋友可以參考下2015-09-28- 這篇文章主要為大家介紹了CSS實現(xiàn)菜單背景自適應(yīng)寬度的方法,涉及基于css屬性控制背景圖片自適應(yīng)寬度的技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-09-28
純CSS+XHTML實現(xiàn)的二級導(dǎo)航菜單效果
這篇文章主要為大家介紹了純CSS+XHTML實現(xiàn)的二級導(dǎo)航菜單效果,通過簡單的鼠標(biāo)事件操作頁面元素樣式變換實現(xiàn)二級導(dǎo)航菜單的功能,非常簡單實用,需要的朋友可以參考下2015-09-25CSS基于單張背景圖實現(xiàn)自適應(yīng)寬度的圓角菜單效果代碼
這篇文章主要為大家介紹了CSS基于單張背景圖實現(xiàn)自適應(yīng)寬度的圓角菜單效果代碼,基于css實現(xiàn)自適應(yīng)寬度的圓角菜單效果,非常簡單實用,需要的朋友可以參考下2015-09-21- 這篇文章主要為大家介紹了純CSS實現(xiàn)的三級導(dǎo)航菜單效果代碼,通過css控制頁面元素樣式實現(xiàn)三級導(dǎo)航菜單效果,非常簡單實用,需要的朋友可以參考下2015-09-18
- 這篇文章主要為大家介紹了基于CSS實現(xiàn)的4級下拉菜單效果代碼,基于css通過對頁面元素樣式的設(shè)置實現(xiàn)四級下拉菜單的效果,具有一定參考借鑒價值,需要的朋友可以參考下2015-09-17
純CSS實現(xiàn)超簡單的二級下拉導(dǎo)航菜單代碼
這篇文章主要為大家介紹了純CSS實現(xiàn)超簡單的二級下拉導(dǎo)航菜單代碼,涉及css針對hover樣式設(shè)置的相關(guān)技巧,非常簡單實用,具有一定參考借鑒價值,需要的朋友可以參考下2015-09-15- 這篇文章主要為大家介紹了CSS實現(xiàn)的中英文雙語菜單效果代碼,涉及css中hover屬性的使用技巧,界面美觀實用,具有一定參考借鑒價值,需要的朋友可以參考下2015-09-15
CSS實現(xiàn)帶有小圖片的LI圖標(biāo)列表菜單
這篇文章主要為大家介紹了CSS實現(xiàn)帶有小圖片的LI圖標(biāo)列表菜單,可實現(xiàn)css圖標(biāo)的正常顯示及滑過、點擊呈現(xiàn)不同顏色的功能,涉及css針對visited、hover及active等使用技巧,需要2015-09-15- 這篇文章主要為大家介紹了CSS實現(xiàn)有立體感的橫向按鈕式菜單效果代碼,可實現(xiàn)鼠標(biāo)滑過呈現(xiàn)按鈕按下的效果,具有極強(qiáng)的3D立體效果,涉及css基于hover屬性的border邊框設(shè)置技巧,2015-09-15