mardi 14 juin 2016

Minimum rule to create a square button with a letter exactly at the center

When tying to create a button consisting a single letter/glyph how to align that vertically so the letter place exactly at the center of its parent.

Link to FIDDLE

div {
  width: 2em;
  height: 2em;
  background: gray;
  text-align: center;
  line-height: 2em;
}
<div>⬛</div>or
<div>@</div>or
<div>g</div>

Aucun commentaire:

Enregistrer un commentaire