删除输入类型的图像按钮的边框? [英] Remove border off of an input type image button?

查看:93
本文介绍了删除输入类型的图像按钮的边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我到目前为止的代码:

Here is the code I have so far:

HTML:

<!DOCTYPE html>
...
<form>
    <input type="image" value=" " class="btnimage" />
</form>
...

CSS:

.btnimage {
    width: 80px;
    height: 25px;
    background:url('C:/Users/John/Desktop/Misc Things for the CoD Ghosts Site/SubmitButton.png');
}
.btnimage:hover {
    background-position: 0 -25px;
    background:url('C:/Users/John/Desktop/Misc Things for the CoD Ghosts Site/SubmitButtononHover.png');
}

上面的代码有效,但是按钮周围有一个边框,我想删除它.到目前为止,我已经尝试将background-border:0;添加到两个类中,但没有用.

The above code works, but there's a border that surrounds the button, which I want to go away. So far, I've tried adding background-border:0; to both of the classes, and it did not work.

推荐答案

background-border is not a css property

您可以通过将CSS的宽度设置为0或将其样式设置为无来删除边框.

You can remove a border with css by setting it's width to 0 or it style to none.

为避免Internet Explorer遗留错误,必须指定border-widthborder-color才能应用border-style:none.因此,如果您关心我的祖母,最好的选择是使用border:0 none;

To avoid an internet explorer legacy bug, you have to specify a border-width or a border-color to make border-style:none apply. So your best bet if you care about my grandma, it to use border:0 none;

.btnimage {
    border: 0 none;
    width: 80px;
    height: 25px;
    background:url('C:/Users/John/Desktop/Misc Things for the CoD Ghosts Site/SubmitButton.png');
}


由于您没有提到边框何时可见,因此也许在您的输入焦点上可以看到轮廓.


Since you did not mention when your border is visible, perhaps it an outline visible on your input focus.

如果是您的情况,请添加:

If it is your case, add :

.btnimage:focus {
    outline:0
}

这篇关于删除输入类型的图像按钮的边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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