Skip to content

hoc-demos/css-centering-content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSS Centering Content

Width, Margins

This works when you know the width of the content.

body {
  margin-left:auto;
  margin-right:auto;
  width:300px;
} 

Flex, Align Center Vertical/Horizontal

This is a bit easier because you don't need to set the width.

body {
  display:flex;
  flex-direction:column;
  justify-content: center;
  align-items: center;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published