CSS is traditionally used to create rollover effects with two or more images for menus and other elements. Menus can use on, off, or visited images to signify the state of the menu. Typically menus are created using multiple background images, however. The problem with this method is that it doubles the necessary HTTP requests and can cause flickering problems when the "off" image is not preloaded. A better way is to combine the on and off state images into one mini-sprite and switch the background position on rollover (see Figure 1).
Figure 1: Multiple-image Rollover Sprite
Figure 1 shows the on and off image mini-sprite (enlarged for easier viewing). To display the on and off portion of our image we just need to change the background position in our menu. Here is the code:
a:link, a:visited {
display: block;
width: 127px;
height:25px;
line-height: 25px;
color: #000;
text-decoration: none;
background: #fc0 url(image-rolloverdual.png) no-repeat left top;
text-indent: 25px;
color: #000;
}
a:hover {
/* background: #c00; */
background-position: right top;
color: #fff;
}
The background in the off state (:link) positions the background image to the left and top showing the off state portion of the image. On rollover (:hover) the background position is shifted to the right displaying the “on” portion of the background image. The width value effectively clips the image to show only the portion of the image that you want displayed. You can also use this technique to highlight visited links. For extra credit, create the above effect entirely with CSS.
Here is the finished version of the dual rollover.
分享到:
相关推荐
标题中的"mono-2.0-bdwgc.zip"是一个压缩包文件,其中包含"mono-2.0-bdwgc.dll"这个动态链接库文件。在Unity游戏开发环境中,Mono是Unity用于实现.NET框架的一个开源实现,它使得开发者可以使用C#、VB.NET或F#等.NET...
标题《Mono-mbe版源码编译.pdf》所包含的知识点主要围绕在Linux环境下编译Unity Mono-mbe版本源码的过程,尤其是生成用于安卓平台上的动态链接库(dll)热更新和dll加密的libmonobdwgc-2.0.so文件。接下来,我将详细...
Xamarin 2.0 (mono-android-4.6.00049)完整安装包 2/2
解决某些系统炉石传说GetThreadContext failed崩溃问题
"mono-2.0-bdwgc"部分指的是Unity在这个版本中使用的特定版本的Mono运行时,其中"bdwgc"代表Boehm-Demers-Weiser垃圾收集器,这是一种保守的垃圾回收器,用于管理内存,自动清理不再使用的对象,防止内存泄漏。...
离线安装包,亲测可用
mono-6.12.0.107-x64-0.msi
dejavu-lgc-sans-mono-fonts-2.33-1.el6.noarch.rpmdejavu-lgc-sans-mono-fonts-2.33-1.el6.noarch.rpm
mono-unity核心源码 版本: 2019.4-mbe 已删除c#部分代码, 另外附带其依赖库, VS2015可以直接编译
JetBrainsMono-2.242字体
The Uno Platform is a Universal Windows Platform Bridge that allows UWP-based code (C# and XAML) to run on iOS, Android, and WebAssembly.
"mod-mono-master" 是一个与 Mono 开源项目相关的压缩包,主要包含的是 Mono 的 mod_mono 模块的源代码。Mono 是一个跨平台的开源软件开发环境,它实现了 .NET Framework 的大部分功能,允许开发者在 Linux、macOS、...
在"小海要自强+VINS-Mono-Optimization-master.zip"这个压缩包中,可能包含了VINS-Mono算法的源代码,这将涵盖从特征提取、匹配、跟踪,到点线优化和滤波器实现的全部细节。通过阅读和理解这些源代码,开发者可以...
mono-6.6.0.161, 2019-12-10官方最新发布版本,墙内基本无法下载 The latest stable release is 6.6.0 Stable (6.6.0.161)
标题中的"mono-3.2.3-gtksharp-2.12.11-win32-0"是Mono的一个特定版本,针对Windows XP操作系统,并且包含了GTK#库的2.12.11版。GTK#是Mono项目的一部分,它为.NET程序员提供了使用C#等语言开发图形用户界面(GUI)...
mono-unity-5.3 mono-unity-5.3 mono-unity-5.3 mono-unity-5.3 mono-unity-5.3
mono-core-4.2.4-7.el7.x86_64.rpm
在"mono-design-v2.1.3"这个文件中,我们可以预见到这应该是Mono Design的版本2.1.3安装程序或应用程序包。用户通常会通过这个文件来安装和运行该软件,以利用其丰富的功能集。此版本可能包含了软件的最新更新和改进...