CSS3 hints and code examples
CSS3 is very straight forward. This page is designed as a quick revision of lesser used types and for code examples to help me.
Home | Applications | Documentation | Transport | Personal |
Web | AJAX | CSS3 | DOM | HTML5 | JavaScript | JQuery | Node.JS | TypeScript |
CSS3 hints and code examples
CSS3 is very straight forward. This page is designed as a quick revision of lesser used types and for code examples to help me.
Centering a block (basic)
body { background-color: aqua; color:red; }
div { background-color: azure; width: 12em;
margin-left: auto; margin-right: auto;
border-radius: 1em; padding: 1em; }
h2 { text-align: center; }
Centering a block (flex)
body { background-color: aqua; color:red;
display: flex; align-items: center;
justify-content: center; }
div { background-color: azure; border-radius: 1em;
padding: 1em; width: 40em; }
h2 { text-align: center; }