9951 explained code solutions for 126 technologies


cssHow to align a div horizontally on the page


div { width: 900px; margin: 0 auto; }ctrl + c
div

element to align horizontally

width: 900px

set width of the element to align

margin: 0 auto

will automatically set left and right margin of the element to the same value (thus making element centered)