样式化按钮:使用锚点或输入? [英] Styling a Button: Use Anchor or Input?

查看:160
本文介绍了样式化按钮:使用锚点或输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我搜索一个css按钮生成器时,他们总是有代码来定义锚点。

When I search for a css button generator they always have code that styles an anchor.

<a href="#" class="button">The Button</a>

但我想知道为什么他们不试图设计一个通用按钮:

But I'm wondering why they don't ever try to style a generic button:

<input type="button" value="The Button" />

是因为难以为类型按钮的输入设置样式?

is it because it's harder to style an input of type button?

推荐答案

样式将使按钮和锚点看起来一样。但是功能方面是什么让你决定使用按钮或链接。

The styling will make buttons and anchors look the same. However the functional aspects are what make you decide to use a button or a link.

我建议使用链接,如果你要跟随一个链接,一个按钮如果你想提交一个表单或执行一个动作,说AJAX调用。

I would recommend using a link if you are going to follow a link, and a button if you want to submit a form or perform an action, say AJAX call.

这篇关于样式化按钮:使用锚点或输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆