how to centre h1 in css code example
Example 1: center h1 css
h1 {
width:500px;
margin: 0 auto;
background: gray;
text-align: center;
}
Example 2: how to center text in css
.class {
text-align: center;
}
Example 3: html move h1 to center
div{
height: 400px;
width: 800px;
background: red;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}