html - 将图像添加到输入类型提交

标签 html css

我有一个带有 SVG 图像的按钮。我已成功为 div 添加图像,但不确定如何将其应用于输入标签。

例如:

.formLink {
  text-align: center;
  display: inline-block;
  margin: 0 0 88px;
  transition: all .25s ease;
  max-width: 100%;
  box-sizing: border-box;
  background: linear-gradient(to right, #e82171, #ef3e36);
  padding: 24px 40px;
  border-radius: 100px;
  -webkit-border-radius: 100px;
  -moz-border-radius: 100px;
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  font-family: 'GeomanistRegular', sans-serif;
  cursor: pointer;
  font-weight: 900;
  line-height: 1em;
  margin-right: 0;
  margin-left: 0;
  transition: all .6s;
}

i.arrow {
  background: no-repeat;
  background-image: url(https://cdn2.hubspot.net/hubfs/548247/Tomorrow%20People/Landing%20Page/Template%20Build/Arrow.svg);
  padding: 7px;
  margin: 4px 0 4px 10px;
  float: right;
  transition: all 0.2s;
}


/***********/

input {
  text-align: center;
  display: inline-block;
  margin: 28px 0 1em;
  transition: all .25s ease;
  max-width: 100%;
  box-sizing: border-box;
  padding: 24px 1.2em;
  width: 220px;
  border-radius: 50px;
  -webkit-border-radius: 50px;
  -moz-border-radius: 50px;
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  font-family: 'GeomanistRegular', sans-serif;
  cursor: pointer;
  font-weight: 900;
  line-height: 1em;
  background: linear-gradient(to right, #e82171, #ef3e36);
  border: 0;
  transition: all .6s;
  /*background: url(https://cdn2.hubspot.net/hubfs/548247/Tomorrow%20People/Landing%20Page/Template%20Build/Arrow.svg) no-repeat scroll 14px 7px;
    background-size: 20px;*/
}
<div class="formLink">Download now <i class="arrow"></i></div><br>
<input type="submit" value="Send Message" class="hs-button primary large" data-reactid=".hbspt-forms-0.4.1.0">

如您所见,我已尝试将 background:url 添加到输入中,但它隐藏了我的整个按钮?

我基本上希望发送消息按钮看起来像立即下载按钮。

想法? 我无法更改输入的 HTML。需要通过 CSS 来实现

最佳答案

这是一个工作示例 http://jsfiddle.net/xpvt214o/328055/

<div class="formLink">Download now <i class="arrow"></i></div><br>
<button type="submit" value="Send Message" class="hs-button primary large formLink" data-reactid=".hbspt-forms-0.4.1.0"> Send Message<i class="arrow"></i></button>

关于html - 将图像添加到输入类型提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51097953/

相关文章:

javascript - 单击按钮不再触发

css - 一行中的 jQuery UI 可排序元素应该具有相同的高度

javascript - 如何使用 jQuery 正确添加和删除 div 标签?

jquery - CSS 中的事件选项卡

php - 如何使用 PHP 从 HTML 表单检查数据库记录

html - 用背景图像覆盖正文

javascript - Jquery 验证是具体的

javascript - Jquery Mobile 使脚本执行两次

javascript - 具有表格单元格属性的 div 内的水平对齐链接

javascript - 以编程方式更改动画规则中的 webkit-transformation 值