简体   繁体   English

提交按钮顶部的图像图标

[英]image icon on top of the submit button

I am working on a submit button in Drupal. 我正在使用Drupal中的“提交”按钮。 I use this HTMLcode generated from PHP: 我使用从PHP生成的HTML代码:

<div class="buttons">
    <span class="icon">
        <input type="submit" name="op" id="edit-submit-115" value="Vložiť do košíka"  class="form-submit node-add-to-cart"" />
    </span>
</div>

I want the button to have gradient background which is done by adding some lines in CSS. 我希望按钮具有渐变背景,这可以通过在CSS中添加一些行来完成。

background: #F47C20;
background: -webkit-gradient(linear, left top, left bottom, from(#F88E11), to(#F06015));
background: -moz-linear-gradient(top, #F88E11, #F06015);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015'

Now, I would like to place an image icon on TOP of the button, close to the text. 现在,我想在按钮顶部放置一个图像图标,靠近文本。 I have been searching all day for some clues but couldn't find anything. 我整天都在寻找一些线索,但找不到任何东西。

The page with the button can be found here . 带有按钮的页面可以在这里找到。

Well, here are two other ideas: 好吧,这是另外两个想法:

  1. You can use multiple backgrounds: http://tinkerbin.com/revBP8If 您可以使用多个背景: http//tinkerbin.com/revBP8If

    Note that I had to remove the IE filter property because it was causing the rest of the CSS to fail on Tinkerbin. 请注意,我必须删除IE filter属性,因为它导致其余的CSS在Tinkerbin上失败。 Unfortunately, multiple backgrounds aren't supported by IE8 or below. 不幸的是,IE8或更低版本不支持多个背景。

  2. A more compatible alternative is to use a regular a link instead of an input submit button. 更兼容的替代方法是使用常规的a环节,而不是一个的input提交按钮。 You can insert an img and style it to look like a button, but you'll need a bit of Javascript to submit the form: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml 您可以插入img并设置其样式以使其看起来像一个按钮,但是需要一些Javascript才能提交表单: http//www.javascript-coder.com/javascript-form/javascript-form-submit。 phtml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM