纯CSS实现鼠标经过变色的Box效果

2008-11-14 12:32:00 | 【
  • Firefox

    Get Firefox with Google Toolbar

    The award-winning Web browser just got better. It's free and easy to use. Join the millions of people worldwide enjoying a better Web experience.
    Download Firefox - Free

    Mozilla Firefox
  • Opera

    Your life at your fingertips

    Try Speed Dial™ in Opera's newest Web browser, Opera 9.20. It makes the fastest even faster.
    Download Opera for Windows

    Opera for Windows
  • Explorer

    Get Internet Explorer 7 for your operating system

    Upgrade with confidence. Get downloads for Internet Explorer 7, including recommended updates as they become available.
    Internet Explorer 7 Download

    Internet Explorer 7

CSS控制鼠标滑过Box,Box的背景颜色会相应改变,box可以是不规则的

查看全部代码 View Code

第一步:
点击这里下载源代码及演示图片

第二步:
在网页<head>区添加以下代码

<style type="text/css">
/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this stylesheet and the associated (x)html
is available at http://www.cssplay.co.uk/menus/drop_variations.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This stylesheet and the assocaited (x)html may be modified in any 
way to fit your requirements.

http://www.sharejs.com 整理 
来源于:http://www.cssplay.co.uk
=================================================================== */
 /* common styling */

 /* Set up the default font and ovrall size to include image */
 body {
	background: #fff;
	font-family: "Lucida Grande", Helvetica, Arial, sans-serif;
	font-size: 11px;
}
/* The style starts here */
#tabs {padding:0; margin:0 0 0 15px; list-style:none;}
#tabs li {display:inline; padding:0; background:#f8f8f8; float:left; margin-right:35px; position:relative;}
#tabs li.one {width:190px;}
#tabs li.two {width:240px;}
#tabs li.three {width:190px;}
#tabs li a.outer-link {background:#f8f8f8; display:block; width:100%; position:relative;}
#tabs table {border-collapse:collapse; margin:-1px;}
#tabs li b {display:block; background:transparent url(tab_top.gif) no-repeat 0 0; padding:2px 0 0 5px; height:15px; font-size:0.9em; overflow:hidden;}
#tabs li div {border:1px solid #888; border-width:0 1px 1px 1px; padding:20px 5px 5px 5px;}
#tabs li h3 {padding:0; margin:0; font-family:georgia, serif; font-size:17px;}
#tabs li p {font-family:verdana, serif; font-size:11px; line-height:1.5em;}
#tabs li a {color:#000; text-decoration:none;}
#tabs li a.inner-link {color:#c00; text-decoration:none;}
#tabs li a.inner-link:hover {text-decoration:underline; cursor:default;}
#tabs li.one:hover, #tabs li.one a.outer-link:hover {background:#fef;}
#tabs li.two:hover, #tabs li.two a.outer-link:hover {background:#cff;}
#tabs li.three:hover, #tabs li.three a.outer-link:hover {background:#ffc;}
</style>


第三步:
在网页<body>区添加以下代码

<ul id="tabs">

<li class="one">
<!--[if lte IE 6]><a class="outer-link" href="nogo"><table><tr><td><![endif]-->
<b>Firefox</b>
<div>
<h3><a class="inner-link" href="http://services.google.com/toolbar/firefox?hl=en_GB">Get Firefox with Google Toolbar </a></h3><p>The award-winning Web browser just got better. It's free and easy to use. Join the millions of people worldwide enjoying a better Web experience.<br /><a class="inner-link" href="http://www.mozilla.com/en-US/firefox/">Download Firefox - Free</a></p>
<img src="/code/css/css10/mozilla.gif" alt="Mozilla Firefox" title="Mozilla Firefox" />
</div>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>

<li class="two">
<!--[if lte IE 6]><a class="outer-link" href="nogo"><table><tr><td><![endif]-->
<b>Opera</b>
<div>
<h3>Your life at your fingertips</h3><p>Try Speed Dial&#8482; in Opera's newest Web browser, Opera 9.20. It makes the fastest even faster. <br /><a class="inner-link" href="http://www.opera.com/download/get.pl?id=&amp;thanks=true&amp;sub=true">Download Opera for Windows</a></p>
<img src="/code/css/css10/opera.gif" alt="Opera for Windows" title="Opera for Windows" />
</div>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>

<li class="three">
<!--[if lte IE 6]><a class="outer-link" href="nogo"><table><tr><td><![endif]-->
<b>Explorer</b>
<div>
<h3>Get Internet Explorer 7 for your operating system</h3><p>Upgrade with confidence. Get downloads for Internet Explorer 7, including recommended updates as they become available.<br /><a class="inner-link" href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer 7 Download</a></p>
<img src="/code/css/css10/ie7.gif" alt="Internet Explorer 7" title="Internet Explorer 7" />
</div>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>


</ul>

下载"纯CSS实现鼠标经过变色的Box效果"

  • 本地下载
  • 本地下载2

相关资源