CSS Buttons with Pseudo-elements

In this tutorial, I’ll show you how to create buttons with a twist, using just one anchor tag per button and the great power of CSS.

The
New
Collective

🎨✨💻 Stay ahead of the curve with handpicked, high-quality frontend development and design news, picked freshly every single day. No fluff, no filler—just the most relevant insights, inspiring reads, and updates to keep you in the know.

Prefer a weekly digest in your inbox? No problem, we got you covered. Just subscribe here.

Feedback 80

Comments are closed.
  1. VERY nice effects at work here – I am now officially in love with the particular shades of blue 🙂

    I do worry about CSS bloat with effects like this – not to mention the various shims, plugins, and conditionals that would be required to make them work (or at least degrade more gracefully) on more than just the best browsers.

  2. Nice tutorial, real shame that not even Opera supports this fully… when the buttons are depressed and released, Opera kinda splits the button in half – I think it’s just not redrawing (I have turbo off). Unless I’m missing a vendor prefix somewhere?

    Gutted that most of our customers are (enterprise) IE users – will be some time before I can use this kind of technique on the commercial sites :-/

  3. very nice ! it looks so good ! it worked on <a> , but when I want to use it on input[type=”submit”] input[type=”button”] , I set appearance:none; but the ::before element won’t display -_- what’s the problem, thx~

  4. Gracias! Excelentes botones. Me lo llevo porque me gustaron el ejemplo 4 y 5.

    Saludos.

  5. Hi there,

    I am having trouble changing the color of the buttons. I know that it must be quite simple, but I just can’t figure it out.

    Help?
    Terrence

  6. Hi there,
    These buttons are really nice!
    But whenever I change the colors of the buttons, it only seems to work in Chrome and Firefox, IE9 just keeps the standard blue color.
    I know this is just an experiment, but maybe some can help to resolve this problem, or already has figured it out?

    Greets,

    yesse.

  7. I found a sort of bug in Demo 2. If you put the button into a div with a background the ‘ .a_demo_two::before ‘ will disappear behind it. How can i fix this?

  8. Very well done! It is amazing how underestimated the power of buttons on a site is. Adding little points of flare like this really do make or break a page. I will certainly be keeping up here at codrops to see what other nifty ideas you dream up…so helpful!

  9. How would you change the color? I mean I know how to in CSS, but whenever I try to make a red or green one the colors look off and not as good as the original blue one. Do you have any tips on how to do this?