如何在提交按钮中设置背景图片? [英] how to set background image in submit button?

查看:191
本文介绍了如何在提交按钮中设置背景图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在提交按钮中设置背景图片?

how to set background image in submit button?

我必须使用图片代替常规提交按钮吗?

I have to use a image in place of regular submit button? which way would be best in xhtml/css?

按钮在所有主要浏览器中应该看起来相同,包括IE6,IE7

Button should look same in all main browsers including IE6,IE7

推荐答案

我通常这样做的方式是使用以下css:

The way I usually do it, is with the following css:

div#submitForm input {
  background: url("../images/buttonbg.png") no-repeat scroll 0 0 transparent;
  color: #000000;
  cursor: pointer;
  font-weight: bold;
  height: 20px;
  padding-bottom: 2px;
  width: 75px;
}

和标记:

<div id="submitForm">
    <input type="submit" value="Submit" name="submit">
</div>

如果在各种浏览器中看起来不同,我会要求您使用重置样式表, ,填充,甚至可以边框为零。

If things look different in the various browsers I implore you to use a reset style sheet which sets all margins, padding and maybe even borders to zero.

这篇关于如何在提交按钮中设置背景图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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