Answers for "center a element"

CSS
89

center a div in css

.container {
  display: flex;
  justify-content: center;
  align-items: center;
}
Posted by: Guest on September-09-2020
1

how to center a div

.MyDiv{
  	display: block;
  	margin-left: auto;
	margin-right: auto;
}
Posted by: Guest on August-31-2021
6

centering css elements

// add to the parent element
.parent {
	display: grid;
    place-items: center;
}
Posted by: Guest on August-06-2020
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
0

how to center an element in css

.container{
  display:bock;
  width:fit-content;
  margin:auto;
}
Posted by: Guest on September-23-2021
3

how to center a div

margin:auto
Posted by: Guest on August-13-2020

Browse Popular Code Answers by Language