[whatwg] Fwd: a and button

Garrett Smith dhtmlkitchen at gmail.com
Sun Oct 19 09:23:32 PDT 2008


---------- Forwarded message ----------
From: Garrett Smith <dhtmlkitchen at gmail.com>
Date: Sun, Oct 19, 2008 at 9:12 AM
Subject: Re: [whatwg] a and button
To: Håkon Wium Lie <howcome at opera.com>


Håkon Wium Lie wrote:
>
> Also sprach Kornel Lesinski:
>
>  > > It's not a link. I'd like for buttons to work as links so that they
>  > > take me to a page when I click on them.
>  >  > http://www.w3.org/TR/css3-ui/#appearance
>  >  > a {appearance: button} should do that.
>
> Yes, that's a good proposal. However, it doesn't work in current browsers.
>

Did you investigate that?

> This markup works (in Mozilla, Opera, Webkit), and it looks pretty good:
>
>  <a href="http://www.w3.org/"><button>W3C</button></a>
>
> So, I think HTML5 should describe it.
>


That doesn't sound like a compelling reason to me.

[snip]

> I'd like for links to use the <a>
>
> element.

Then do that.

<!DOCTYPE html>
<head>
       <title>a-button</title>
       <style type="text/css">
a {
 -webkit-appearance: button;
 -moz-appearance: button;
 appearance: button;
}
       </style>
</head>
<body>
<a href="foo.html">asdf</a>
</body>
</html>


ISTM that if you want a link to look like a button, using an anchor
tag and styling it to look like a button is the way to go. It will
degrade more consistently, be more semantic, and won't cause issues
with tabIndex order or keyboard navigation.

Garrett


>
> -h&kon
>              Håkon Wium Lie                          CTO °þe(R)ª
> howcome at opera.com                  http://people.opera.com/howcome
>



More information about the whatwg mailing list