css centre element code example
Example 1: center a div in css
.container {
display: flex;
justify-content: center;
align-items: center;
}
Example 2: center a div css
.center {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Example 3: mettre une image au milieu css
IMG.displayed {
display: block;
margin-left: auto;
margin-right: auto }
...
Example 4: centrer une div
.center-div {
margin: 0 auto;
width: 100px;
}
Example 5: aligner et centrer element css html
.navigation{
width: 100%;
height: 1.8em;
}
li {
display: inline;
padding:5px;
}
////////////////////////////////////////////////////
//////// css///////////
.portrait{
text-align: center;
}
.demo_portrait_1{
padding:10px;
height: 400px;
width: 400px;
}