Answers for "center a div in html"

CSS
15

css align items vertical center

.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}
Posted by: Guest on October-31-2020
0

center a div

.container{
	margin: 0 auto;
    display: flex;
    align-items: center;
}
Posted by: Guest on August-03-2021
21

how to center text in css

.class {
	text-align: center;
}
Posted by: Guest on February-15-2020
0

center div html

//Center DIV HTML5

<body>
    <div style="width:800px; margin:0 auto;">
        centered content
    </div>
</body>
Posted by: Guest on July-30-2021
4

center a div

<div id="outer">
  <div id="inner">Foo foo</div>
</div>
//css:, demo with border
<style>
#inner {
  display: table;
  margin: 0 auto;
  border: 1px solid black;
}

#outer {
  border: 1px solid red;
  width:100%
}
</style>
Posted by: Guest on August-20-2020
1

div center

#inner {
  display: table;
  margin: 0 auto;
  border: 1px solid black;
}

#outer {
  border: 1px solid red;
  width:100%
}
Posted by: Guest on December-07-2020

Browse Popular Code Answers by Language