Vertically Centering Text and HTML Elements With CSSby@smpnjn

Vertically Centering Text and HTML Elements With CSS

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Vertically centering something in CSS is not as easy as you'd think, and until we got tools like flexbox, it was really hard. Centering an item in the middle of the screen with CSS is really easy with flexbox. If we want it to be both centered vertically, and also centered horizontally, then we would update our `container` CSS to look like this:```csscontainer { display: flex; align-items: center;   justify-content: center.

Company Mentioned

Mention Thumbnail
featured image - Vertically Centering Text and HTML Elements With CSS
Johnny Simpson HackerNoon profile picture

@smpnjn

Johnny Simpson


Receive Stories from @smpnjn

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa