Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

how to center a div

/* Assume the div has a class of "center"
   The below would center it horizontally
*/
.center {
	margin-left: auto;
    margin-right: auto; 
}

/* There is a shorthand and it is given below */
.center {
	margin: 0 auto; 
}
 
PREVIOUS NEXT
Tagged: #center #div
ADD COMMENT
Topic
Name
2+9 =