Hacker News new | past | comments | ask | show | jobs | submit login

And it gives some baseline accessibility functionality. Sucks that there isn't any gerneral "I am clickable" element that neither has bad default click behavior, nor has its own likely-unfitting styling.



What's wrong with a button? You can make it look like an <a> can't you?


https://stackoverflow.com/questions/1367409 has varying amounts of CSS for that, ranging from bad (i.e. more than one line, i.e. the bar to beat for people to automatically use it over <a>) to horrific.

Looks like the rough minimum is this:

    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
And, given that some answers there have browser-specific additions, it looks like the spec doesn't have sane effective restrictions on what funky things browsers can do, thus essentially making the answer a "no, you cannot portably make a button look exactly like a link".

And no CSS I could find made the button content flow inline with surrounding text (I even went through all of the computed CSS in FF devtools and added the differing ones to the button), so it looks like the answer is "no" in practice too. (though, granted, for a good amount of link-buttons out there you'd probably want no mid-button breaking)

Certainly looks like it'd be simpler to make a <span> act like a link, than a <button>, at least. At which point you lose the implicit accessibility functionality.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: