dwyl / learn-tachyons

:heart_eyes: Learn how to use Tachyons to craft beautiful, responsive and fast UI with functional CSS!
https://tachyons-bootstrap.dwyl.com
673 stars 39 forks source link

Understanding more about <span> tags #49

Open Cleop opened 5 years ago

Cleop commented 5 years ago

This is not directly a tachyons issue but rather a html/front end one. I wanted to learn more about when <span> elements should be used and how they behave for styling:

Purpose

Styling behaviour


Examples

Here are a couple of examples where a <span> might not be needed:

This <span> should be a <h2> or another title tag or a <p> tag. It is not being displayed inline and so making it a <span> isn't semantically helpful.

This <span> is not needed, it is wrapped around an <img> element which is already an inline element. So we can save the extra bit of code and do without it.