这款菜单大家需要注意HOVER状态下背景图片定位发生了变化,从而实现了这样的效果。

本实例是一位国外的朋友所写,不进行任何翻译,直接发出来,大家可以偿试阅读,如果遇到困难可以求助于翻译软件。
不断的提高自己的英文阅读能力也是我们一直所提倡的,让我们一起努力吧!

Overview
  Here are the required graphics to assembe the menu

css 背景图片定位在菜单效果中的应用实例
1. Main background
  Open the Photoshop file. Turn off the menu text Layer Group and save the main background as menu-bg.jpg.

css 背景图片定位在菜单效果中的应用实例
2. Button graphics
  Turn off the background Layer Group and leave only the menu text layers visible. Make a rectangle selection cover the "home" item, go to menu Edit > Copy Merged (Cmd + Shift + C).

css 背景图片定位在菜单效果中的应用实例
  Create a new file and take note of the file dimension (w x h), in my case the "home" graphic is 144 x 58px. Paste the "home" graphic in the new file. Go to menu Image > Canvas Size, adjust the image height x 2 (58 + 58 = 116px). Duplicate the home graphic layer and align it to the bottom. Erase the highlight strokes in the upper layer.

css 背景图片定位在菜单效果中的应用实例
  Here is how the hover effect will work. We will set the link button to 144 x 58px, when mouseover, we will shift the background image from top to bottom.

css 背景图片定位在菜单效果中的应用实例
  Repeat this step for the other buttons. You should have the follow graphics:

css 背景图片定位在菜单效果中的应用实例
3. HTML source
  When you are done with the graphics, let’s start coding. Start with an un-ordered list <ul>.
  ● note there is an id="menu" assigned to the<ul> tag
  ● an unique class name assigned to each link <a>
  ● an empty <span> tag (the purpose of this is to make the mouseover effect)

css 背景图片定位在菜单效果中的应用实例 Example Source Code [www.52css.com] <ul id="menu">
   <li><a href="#" class="home">Home <span></span></a></li>
   <li><a href="#" class="about">About <span></span></a></li>
   <li><a href="#" class="rss">RSS <span></span></a></li>
</ul>
#menu
  Reset the menu to no padding, no margin, and no list-style. Specify the width and height same dimension as the menu-bg.jpg. Then attach the menu background image. The key point to remember here is set the position property to relative.

 Example Source Code [www.52css.com] #menu {
   list-style: none;
   padding: 0;
   margin: 0;
   width: 774px;
   height: 210px;
   background: url(images/menu-bg.jpg) no-repeat;
   position: relative;
}
#menu span
  Specify the span element to display:none (so they will be invisible by default). Specify position:absolute, so we can place the mouseover GIF image on exact position.

 Example Source Code [www.52css.com] #menu span {
   display: none;
   position: absolute;
}
#menu a
  The key point here is the text-indent property. We specify the text-indent property with a negative value (-900%), so the text will be hidden.

 Example Source Code [www.52css.com] #menu a {
   display: block;
   text-indent: -900%;
   position: absolute;
   outline: none;
}
#menu a:hover
  When mouseover the link, we want to shift the background image from top to bottom.

 Example Source Code [www.52css.com] #menu a:hover {
   background-position: left bottom;
}
#menu a:hover span
  When mouseover the link, we want the span element to display:block.

 Example Source Code [www.52css.com] #menu a:hover span {
   display: block;
}
#menu .home
  Specify the width, height, and background image. Since we already specified all <a> element postition:absolute in previous step, now just say where the .home button should be by specifying the left and top property.

 Example Source Code [www.52css.com] #menu .home {
   width: 144px;
   height: 58px;
   background: url(images/home.gif) no-repeat;
   left: 96px;
   top: 73px;
}
#menu .home span
  Here we are specifying the width, height, background, and position of the span element of .home (mouseover GIF image)

 Example Source Code [www.52css.com] #menu .home span {
   width: 86px;
   height: 14px;
   background: url(images/home-over.gif) no-repeat;
   left: 28px;
   top: -20px;
}
#menu .about
  Copy the .home rules and rename them to .about. Now just change the width, height, background, left, and top property.

 Example Source Code [www.52css.com] #menu .about {
   width: 131px;
   height: 51px;
   background: url(images/about.gif) no-repeat;
   left: 338px;
   top: 97px;
}
#menu .about span {
   width: 40px;
   height: 12px;
   background: url(images/about-over.gif) no-repeat;
   left: 44px;
   top: 54px;
}
#menu .rss
  Repeat this step for .rss

 Example Source Code [www.52css.com] #menu .rss {
   width: 112px;
   height: 47px;
   background: url(images/rss.gif) no-repeat;
   left: 588px;
   top: 94px;
}
#menu .rss span {
   width: 92px;
   height: 20px;
   background: url(images/rss-over.gif) no-repeat;
   left: 26px;
   top: -20px;
}
All in one:

 Example Source Code [www.52css.com] #menu {
   list-style: none;
   padding: 0;
   margin: 0;
   width: 774px;
   height: 210px;
   background: url(images/menu-bg.jpg) no-repeat;
   position: relative;
}
#menu span {
   display: none;
   position: absolute;
}
#menu a {
   display: block;
   text-indent: -900%;
   position: absolute;
   outline: none;
}
#menu a:hover {
   background-position: left bottom;
}
#menu a:hover span {
   display: block;
}

#menu .home {
   width: 144px;
   height: 58px;
   background: url(images/home.gif) no-repeat;
   left: 96px;
   top: 73px;
}
#menu .home span {
   width: 86px;
   height: 14px;
   background: url(images/home-over.gif) no-repeat;
   left: 28px;
   top: -20px;
}

#menu .about {
   width: 131px;
   height: 51px;
   background: url(images/about.gif) no-repeat;
   left: 338px;
   top: 97px;
}
#menu .about span {
   width: 40px;
   height: 12px;
   background: url(images/about-over.gif) no-repeat;
   left: 44px;
   top: 54px;
}
#menu .rss {
   width: 112px;
   height: 47px;
   background: url(images/rss.gif) no-repeat;
   left: 588px;
   top: 94px;
}
#menu .rss span {
   width: 92px;
   height: 20px;
   background: url(images/rss-over.gif) no-repeat;
   left: 26px;
   top: -20px;
}
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。