Paragraphs and lists

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Age, inquies, ista parva sunt. Inde igitur, inquit, ordiendum est. Hoc Hieronymus summum bonum esse dixit. Tum mihi Piso: Quid ergo?

  • List item one
  • List item two
  • List item three
  • List item four
  • List item five
  • List item six

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Age, inquies, ista parva sunt. Inde igitur, inquit, ordiendum est. Hoc Hieronymus summum bonum esse dixit. Tum mihi Piso: Quid ergo?

Quorum altera prosunt, nocent altera. Non risu potius quam oratione eiciendum? Primum in nostrane potestate est, quid meminerimus? Et harum quidem rerum facilis est et expedita distinctio.

  • List item one
    • List item one
      • List item one
      • List item two
      • List item three
      • List item four
    • List item two
    • List item three
    • List item four
  • List item two
  • List item three
  • List item four

Est, ut dicis, inquam. Duo Reges: constructio interrete. Sed in rebus apertissimis nimium longi sumus. Primum in nostrane potestate est, quid meminerimus?

Inquit, dasne adolescenti veniam? Quae cum dixisset, finem ille. Beatum, inquit. Quis est tam dissimile homini. Videamus animi partes, quarum est conspectus illustrior;

How to reset and style HTML buttons

Resetting and restyling HTML buttons without a CSS framework...

Checklist

  • color
  • background-color
  • cursor for disabled buttons
  • font-size
  • font-family
  • line-height
  • margin
  • min-height and min-width

Reset

button {
  box-sizing: border-box;
  margin: 0;
  line-height: inherit;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

line-height may need attention if there are buttons with multiple lines of text. All other spacing can be controlled with the button height and the button padding.

NEXT. Prevent accidental selection of the button text on touch devices:

button {
  user-select: none;
}

[....] (true for Firefox xx.xx, Google Chrome xx.xx and Safari 14.0 as of November 2020). [....]

button {
  display: inline-flex;
}

Vertical and horizontal alignment within the flex box:

button {
  align-items: center;
  justify-content: center;
}

Set a border. The border color can later be changed for the different states of solid buttons or it can be set to currentColor for outlined buttons.

button {
  border: 2px solid transparent;
}

Dimensions

Set minimum size. WCAG 2.1 recommendation. Google recommendation.

button {
  min-width: 44px;
  min-height: 44px;
}

Disabled buttons

button:disabled {
  opacity: 0.5;

  cursor: not-allowed;
}

Interactive states (hover and active)

Put together

button {
  box-sizing: border-box;

  display: inline-flex;

  align-items: center;
  justify-content: center;

  margin: 0;

  min-width: 44px;
  min-height: 44px;

  border: 2px solid transparent;

  background-color: #080;

  padding: 0.25em 1.25em;

  line-height: inherit;

  color: #fff;

  font-family: inherit;
  font-size: inherit;

  user-select: none;
}

button:disabled {
  opacity: 0.5;

  cursor: not-allowed;
}

button:hover {
  background-color: #060;
}

button:active {
  background-color: #090;
}

button:focus {
}

Notes

  • :active does not seem to happen when hitting Enter.

Browser compatibility

  • Safari 10 and earlier does not support flex or inline-flex on buttons.
  • Alternative to flex for Safari 10 and earlier: text-align: center and vertical-align: center.

Resources

Resources: Working

Resources: :active

List of design systems and style guides

Also see: github.com/bradtraversy/design-resources-for-developers

Markup: Image Alignment

Welcome to image alignment! The best way to demonstrate the ebb and flow of the various image positioning options is to nestle them snuggly among an ocean of words. Grab a paddle and let's get started.

On the topic of alignment, it should be noted that users can choose from the options of None, Left, Right, and Center. In addition, they also get the options of Thumbnail, Medium, Large & Fullsize.

The image above is centered.

This paragraph and the next one are here for seeing how they wrap around a small image (150×150) which is aligned to the left. The image should have enough room to breathe.

Lorem ipsum: Lorem ipsum dolor sit amet, consectetur adipiscing elit. In quibus doctissimi illi veteres inesse quiddam caeleste et divinum putaverunt. Quod quidem iam fit etiam in Academia. Familiares nostros, credo, Sironem dicis et Philodemum, cum optimos viros, tum homines doctissimos. Non enim iam stirpis bonum quaeret, sed animalis. Duo Reges: constructio interrete. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In quibus doctissimi illi veteres inesse quiddam caeleste et divinum putaverunt. Quod quidem iam fit etiam in Academia. Familiares nostros, credo, Sironem dicis et Philodemum, cum optimos viros, tum homines doctissimos. Non enim iam stirpis bonum quaeret, sed animalis. Duo Reges: constructio interrete.

Next is a large image with no alignment at all.

The image above, though 1200px wide, should not overflow the content area. It should remain contained with no visible disruption to the flow of content.

And now we're going to shift things to the right align. Again, there should be plenty of room above, below, and to the left of the image. Just look at him there... Hey guy! Way to rock that right side. I don't care what the left aligned image says, you look great. Don't let anyone else tell you differently.

In just a bit here, you should see the text start to wrap below the right aligned image and settle in nicely. There should still be plenty of room and everything should be sitting pretty. Yeah... Just like that. It never felt so good to be right.

And just when you thought we were done, we're going to do them all over again with captions!

Image Alignment 580x300
Look at 580x300 getting some caption love.

The image above happens to be centered. The caption also has a link in it, just to see if it does anything funky.

Image Alignment 150x150
A tiny caption.

The rest of this paragraph is filler for the sake of seeing the text wrap around the 150x150 image, which is left aligned.

As you can see the should be some space above, below, and to the right of the image. The text should not be creeping on the image. Creeping is just not right. Images need breathing room too. Let them speak like you words. Let them do their jobs without any hassle from the text. In about one more sentence here, we'll see that the text moves from the right of the image down below the image in seamless transition. Again, letting the do it's thang. Mission accomplished!

And now for a massively large image. It also has no alignment.

Image Alignment 1200x400
Massive image comment for your eyeballs.

The image above, though 1200px wide, should not overflow the content area. It should remain contained with no visible disruption to the flow of content.

Image Alignment 300x200
Feels good to be right all the time.

And now we're going to shift things to the right align. Again, there should be plenty of room above, below, and to the left of the image. Just look at him there... Hey guy! Way to rock that right side. I don't care what the left aligned image says, you look great. Don't let anyone else tell you differently.

In just a bit here, you should see the text start to wrap below the right aligned image and settle in nicely. There should still be plenty of room and everything should be sitting pretty. Yeah... Just like that. It never felt so good to be right.

And that's a wrap, yo! You survived the tumultuous waters of alignment. Image alignment achievement unlocked! One last thing: The last item in this post's content is a thumbnail floated right. Make sure any elements after the content are clearing properly.

Markup: Text Alignment

Default

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quid de Pythagora? Ego vero volo in virtute vim esse quam maximam; Itaque nostrum est-quod nostrum dico, artis est-ad ea principia, quae accepimus. Suam denique cuique naturam esse ad vivendum ducem. Duo Reges: constructio interrete. Totum autem id externum est, et quod externum, id in casu est. Quamquam haec quidem praeposita recte et reiecta dicere licebit. Bonum negas esse divitias, praeposìtum esse dicis? Hic ambiguo ludimur.

Left

Unum nescio, quo modo possit, si luxuriosus sit, finitas cupiditates habere. Non est enim vitium in oratione solum, sed etiam in moribus. Quis enim redargueret? Videmusne ut pueri ne verberibus quidem a contemplandis rebus perquirendisque deterreantur? Fortitudinis quaedam praecepta sunt ac paene leges, quae effeminari virum vetant in dolore. Octavio fuit, cum illam severitatem in eo filio adhibuit, quem in adoptionem D. Quod quidem iam fit etiam in Academia. Obsecro, inquit, Torquate, haec dicit Epicurus? Quae cum dixisset paulumque institisset, Quid est?

Center

Ipse Epicurus fortasse redderet, ut Sextus Peducaeus, Sex. Voluptatem cum summum bonum diceret, primum in eo ipso parum vidit, deinde hoc quoque alienum; Nam aliquando posse recte fieri dicunt nulla expectata nec quaesita voluptate. Haec bene dicuntur, nec ego repugno, sed inter sese ipsa pugnant. Nulla profecto est, quin suam vim retineat a primo ad extremum.

Right

Superiores tres erant, quae esse possent, quarum est una sola defensa, eaque vehementer. Quae cum dixisset paulumque institisset, Quid est? In his igitur partibus duabus nihil erat, quod Zeno commutare gestiret. Quorum altera prosunt, nocent altera. Rationis enim perfectio est virtus; Stoici autem, quod finem bonorum in una virtute ponunt, similes sunt illorum; Sin ea non neglegemus neque tamen ad finem summi boni referemus, non multum ab Erilli levitate aberrabimus. Quando enim Socrates, qui parens philosophiae iure dici potest, quicquam tale fecit? Illa tamen simplicia, vestra versuta.

Justify

Huius, Lyco, oratione locuples, rebus ipsis ielunior. Ergo adhuc, quantum equidem intellego, causa non videtur fuisse mutandi nominis. Omnis enim est natura diligens sui. Nam, ut sint illa vendibiliora, haec uberiora certe sunt. Nec vero alia sunt quaerenda contra Carneadeam illam sententiam. Atque ab his initiis profecti omnium virtutum et originem et progressionem persecuti sunt.