div center content in the center code example Example: how to assign something in center inside a div P { text-align: center } H2 { text-align: center }