-3
I’m starting now with JS, I created a div and wanted the text inside it to always be in the center of the box. How can I do that?
What I have so far :
div#CaixaPrincipal{
background: white;
width: 600px;
height: 300px;
margin : 0 auto 0 auto;
align-items : center;
font : normal 15pt Arial;
}
Actually the line "align-items" doesn’t exist, I was testing to see if it lined up but it didn’t work :/
– Alex Junior Pereira
This is not Javascript, it’s CSS.
– Sam
But this code is CSS friend, not JS rs'
– Mateus Daniel
Just add
display: flex;
andjustify-content: center;
. That takes care of.– Sam
Without seeing your HTML not to answer you, most likely you are using the wrong property, since your container has no flex, a simple
text-align: center;
must solve– hugocsl