制作<按钮和GT;这是在HTML中的链接 [英] Making a <button> that's a link in HTML

查看:140
本文介绍了制作<按钮和GT;这是在HTML中的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我喜欢的方式,<输入类型=提交> 时加少许CSS的样式,用点击按钮。然而,常规的按钮没有风格正因为如此,他们没有这样的可以点击的,而不一些重大CSS或JS,你必须使用的图片。

我在提交按钮进入链接,通过使用表单操作,但这需要我做一种新的形式为每个按钮。我如何才能找到一个折中?利用多种形式引起我的造型问题,我似乎无法修复,除非我找到另一种方式,使那些在HTML链接按钮,即有一个默认的风格,使他们有一个pressed状态(我不'T意味着浏览器的默认设置)。

任何想法?


解决方案

 < A HREF =#><按钮>链接文字< /按钮>< / A&GT ;

您要求的,看起来像一个按钮一个环节,所以用一个链接和一个按钮:-)这将preserve默认浏览器按钮样式。本身按钮不执行任何操作,但点击它会激活其父链接。

Basically, I like the way that <input type="submit"> is styled, with the clickable button when you add a little CSS. However, regular buttons are not styled as such, they have no such clickability without some major CSS or JS, and you have to use images.

I made submit buttons into links, by using the form action, but this requires me to make a new form for each button. How can I find a happy medium? Using multiple forms is causing problems in my styling that I can't seem to fix unless I find another way to make buttons that are links in HTML, that have a default style that makes them have a pressed state (and I don't mean browser default settings).

Any ideas?

解决方案

<a href="#"><button>Link Text</button></a>

You asked for a link that looks like a button, so use a link and a button :-) This will preserve default browser button styling. The button by itself does nothing, but clicking it activates its parent link.

这篇关于制作&LT;按钮和GT;这是在HTML中的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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