【问题标题】:Input type="image" not loading in IE输入类型=“图像”未在 IE 中加载
【发布时间】:2013-09-10 19:19:46
【问题描述】:

我在 WordPress 网站中使用提交按钮。这是我的按钮 HTML:

<input class="greenbut" onclick="set_srch();" type="image" alt="Search" value="Search"/>

style.css 我有:

.search_box .greenbut
{
    width: 50px;
    height: 19px;
    text-align: center;
    color: #333333;
    line-height: 30px;
    padding-top: 10px;
    padding-right: 15px;
    padding-bottom: 0px;
    padding-left: 15px;
    font-family: DroidSansRegular;
    font-size: 13px;
    margin-top: 31px;
    margin-left: 0px !important;
    float: left;
    cursor: pointer;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
    background-image: none;
    background-attachment: scroll;
    background-repeat: repeat;
    background-position-x: 0px;
    background-position-y: 0px;
    background-size: auto;
    background-origin: padding-box;
    background-clip: border-box;
    background-color: rgb(137, 206, 71);
}

在其他浏览器中没问题,但在 IE 中是这样的:

在 Chrome 和 Firefox 中看起来像这样:

如何解决 IE 问题?

【问题讨论】:

  • 图片src在哪里?
  • 我得到了修复,真的不明白为什么开发人员使用它
  • 他使用 bg 颜色、文本进行搜索并且没有图像导致问题,即如何解决?
  • @putvande windows 7 默认。
  • 这里真正的解决方案是在输入元素中添加一个src 属性。更好的解决方案是根据使用情况更改要提交的输入类型或按钮,并使用 CSS 直观地对其进行样式设置。

标签: html css wordpress internet-explorer


【解决方案1】:

尝试使用&lt;input type="submit"&gt;

【讨论】:

  • 你能解释一下为什么 OP 不能使用input type="image"吗?
  • 我在你的 css 中没有看到任何图像 src。
【解决方案2】:

尝试在您的代码中添加此&lt;input type="hidden" alt="Search" value="Search" /&gt; 并删除alt="Search"

【讨论】:

  • 什么?这与提出的问题无关。
  • IE 的工作方式真的很奇怪,在“输入类型=图像和值”旁边你放了其他东西,这就是我写这个的原因。
【解决方案3】:

type="image" 的意义在于充当服务器端图像映射,图像的 URL 由src 属性指定。您没有其中之一,您的所有样式都是使用 CSS 完成的,并且您依赖浏览器以一致的方式处理丢失的图像及其替代 (alt) 内容。由于 IE 除了 alt 文本之外还显示了一个图标,表明该图像丢失,所以这不起作用。

改用真正的提交按钮:

<input class="greenbut" type="submit" value="Search">

您可能需要调整 CSS 以补偿不同的默认边框/边距/填充/等。

【讨论】:

  • 是的,已经解决了,不知道我是谁干的,我怎样才能让我使用这个 css 而不是依赖图像
  • 你照我说的做。您使用的是提交按钮而不是图像映射。
猜你喜欢
  • 1970-01-01
  • 2012-11-15
  • 2012-08-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-15
  • 2012-06-24
  • 1970-01-01
相关资源
最近更新 更多