Answers for "how to set content center of div in css"

CSS
1

align div content center

.child {
  ...
  margin: 0 auto;
}
Posted by: Guest on July-30-2021
1

css center div

.my-div{
  width: 80%;
  margin: 10px auto;
  /*
    margin-left and right right has 'auto' value
    meaning that the browser will automatically calculate the remaining space
    and give it to the margin.
    From the example. 20% remained from 80%
    so that our div will have 
    margin-right: 10%
    margin-left: 10%
    and it will be centered.
  */
}
Posted by: Guest on June-12-2021

Code answers related to "how to set content center of div in css"

Browse Popular Code Answers by Language