如何制作悬停按钮? [英] How to make hover buttons?

查看:100
本文介绍了如何制作悬停按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个CSS类,以便我可以像这样使用

I want to make a CSS class so that i can use it like this

<input type="button" class="hoverbuttons">

那么如何创建一个类来让我的按钮悬停呢?

So how do I make a class so that my button will hover?

我有两个按钮。假设这些URL是URL1和URL2,我如何使他们可以使用CSS悬停?

I have two buttons already. Assuming those URLs to be URL1 and URL2 how can I make them hover-able using CSS?

推荐答案

最简单的方法是使用精灵。您需要将< input> 标记更改为< a> 标记:

The easiest way is to use sprites. You'll need to change the <input> tags to <a> tags:

<style>

a.link1 {
display:block;
height:10px;
background:url(image.jpg) no-repeat 0 0;
}

a.link1:hover {
background:url(image.jpg) no-repeat 0 -10px;
}

</style>

<a href="URL1" class="link1">foo</a>

这篇关于如何制作悬停按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆