Making a <button> that's a link in HTML

前端 未结 7 1236
野的像风
野的像风 2020-12-09 08:49

Basically, I like the way that is styled, with the clickable button when you add a little CSS. However, regular buttons are not st

7条回答
  •  轮回少年
    2020-12-09 09:23

    You have three options:

    • Style links to look like buttons using CSS.

      Just look at the light blue "tags" under your question.

      It is possible, even to give them a depressed appearance when clicked (using pseudo-classes like :active), without any scripting. Lots of major sites, such as Google, are starting to make buttons out of CSS styles these days anyway, scripting or not.

    • Put a separate

      element around each one.

      As you mentioned in the question. Easy and will definitely work without Javascript (or even CSS). But it adds a little extra code which may look untidy.

    • Rely on Javascript.

      Which is what you said you didn't want to do.

提交回复
热议问题