how to center a div element with css code example Example: how to center text in css .class { text-align: center; }