Answers for "align content to center css"

3

css center text in div

/* For horizontal align: */
parent-element {text-align:center;}
/* For horizontal and vertical align: */
parent-element {position: relative;}
element-to-be-centered {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* See https://www.w3schools.com/css/css_align.asp for more info */
Posted by: Guest on October-25-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
1

align centre

.headerTwoDiv{
			margin:1% auto;
			margin-right: auto; margin-left: auto; width: 21%; 
			padding-top: 11px;
		}
Posted by: Guest on September-07-2020
3

how to center a div

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

Code answers related to "align content to center css"

Browse Popular Code Answers by Language