Giter Club home page Giter Club logo

Comments (3)

speg avatar speg commented on May 21, 2024 3

Yaaaaaas 🙌🏼 I came here for this and am happy to see it already exists.

I had two buttons and an anchor in a grid, under a textarea. It looked so silly because the one anchor had such a larger height. I had to use an anchor because I wanted to make use of target=_blank.

To work around this, I needed up converting it to a button and using onlick=window.open...

Reading the explanation here, I think it makes sense – but like @pachacamac said adding it to the docs to explain it would give that reasoning before trying to fight with it.

from pico.

lucaslarroche avatar lucaslarroche commented on May 21, 2024

Hi @pachacamac,

TL;DR: It's a feature, not a bug.

Actually both <button> and <a> are inline elements.
As both can be inside a <p>, we should not really define a margin-bottom.

But Pico is sometimes slightly opinionated 🙂.

I considered that:

  • Links are most likely inside a <p> and don't need to have a margin.
  • Buttons are most likely outside of a <p> and therefore need a margin-bottom in the context of a form.

I'm open to suggestions.

from pico.

pachacamac avatar pachacamac commented on May 21, 2024

Hey @lucaslarroche,

Thanks for the explanation. Even though personally I would probably still prefer no difference, it makes sense from that point of view.

I would just add it to the docs because there it sounds like they're 100% interchangeable:

Buttons are width: 100%; by default. Use <a role="button"> if you need an inline element.

from pico.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.