css 输入提交链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5734584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 00:20:49  来源:igfitidea点击:

css input submit link

css

提问by SuperString

I have this html:

我有这个 html:

      <form id="REVIEW" method="post" action="/SortReviews">
        <fieldset class="sort">
          <input type="submit" value="$ratingLine"/>            
        </fieldset>
      </form>

I want to give the submit button some css, so it looks like a link.

我想给提交按钮一些 css,所以它看起来像一个链接。

{
    background: none;
    border: none;
    color: blue;
    text-decoration: underline;
    cursor: pointer;
}

How do I do it?

我该怎么做?

回答by Herman Schaaf

<style type="text/css">
form input[type="submit"]{

    background: none;
    border: none;
    color: blue;
    text-decoration: underline;
    cursor: pointer;
}
</style>

Is this not what you're looking for?

这不是你要找的吗?

The other option, as already noted, is to use javascript to submit the form onclick of a anchor element:

如前所述,另一种选择是使用 javascript 提交表单 onclick 锚元素:

<a href="#" onclick="document.review.submit()">submit</a>       

with your form having an attribute: name="review"

您的表单具有一个属性: name="review"

回答by Gabriele Petrioli

You should assign a class to the button

您应该为按钮分配一个类

<input type="submit" value="$ratingLine" class="link-lookalike"/>

and in your css file (or inside a <style type="text/css"></style>tag) use

并在您的 css 文件(<style type="text/css"></style>标签内)中使用

.link-lookalike {
    background: none;
    border: none;
    color: blue;
    text-decoration: underline;
    cursor: pointer;
}

this way you can assign the class to different buttons in your page (if required), and they will all get the same look.

通过这种方式,您可以将类分配给页面中的不同按钮(如果需要),它们都将获得相同的外观。

回答by Tim Hettler

Use the button element:

使用按钮元素:

<button type="submit">$ratingLine</button>

回答by Eric Frick

You need to add a class, for example "submitClass".

您需要添加一个类,例如"submitClass".

<input type="submit" value="$ratingLine" class="submitClass"/>

   .submitClass {
        background: none;    
        border: none;    
        color: blue;    
        text-decoration: underline;    
        cursor: pointer;
   }

回答by Ryan Walton

Here's how I did it with html and css:

这是我使用 html 和 css 的方法:

<p><form class='input-to-link-form'><input type="submit" value="Place your order" class="input-to-link"></form> and make payment.</p>

.input-to-link {
  margin: 0;
  padding: 0;
  color: #0088cc;
  text-decoration: none;
  font-weight: 300;
  cursor: pointer;
  background: none;
  border: none;
}

.input-to-link-form {
  margin: 0 4px 0 0;
  padding: 0;
  float: left;
}