我正在尝试删除 alt 标记文本的边框。我在 paypal 表单中使用透明图像作为按钮,通过 css 链接。 paypal 按钮采用 alt 标签作为按钮文本,并在其周围放置边框。我不清楚为什么会发生这种情况,但这是我必须与 Paypal 合作的。显然我必须使用图像。因此,我使用透明图像,这样我就可以在 css 中对其进行样式设置,使其看起来像我的其他按钮,而不是尝试获取每个按钮状态的屏幕截图。
我将代码配对,仅关注文本“查看购物车”周围的边框。
CSS
//link to my transparent button with no text on it
#vyc {
background-image: url(http://lakenney.com/kenney_lucille-final/images/vyc.png) no-repeat;
}
//the user agent that is controlling the outer border
user agent stylesheetinput[type="hidden" i], input[type="image" i], input[type="file" i] {
-webkit-appearance: initial;
padding: 20px;
background-color: initial;
border: dotted;
border-top-color: red;
}
//a couple of tags I'm using to try to access the alt tag border not working
#vyc img[alt] {
/*border: 1px dashed #3D8EA5;*/
border: transparent !important;
}
input#vyc img[alt] {
border: transparent !important;
}
HTML
这是指向同一代码的 jsfiddle 链接: http://jsfiddle.net/lakenney/w0zpmutn/
最佳答案
输入(type =“image”)需要一个缺少边框的源图像。能不能把透明图片作为src值?
<input type="image" src="http://lakenney.com/kenney_lucille-final/images/vyc.png" id="vyc" border="0" name="submit" value="View Cart" alt="View Cart">
关于html - 删除图像上的 alt 标签文本的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30548922/