I have text on my html site, and I want it to be centered, how can I do this? Already tried to find options, but it never happened! ..

Closed due to the fact that off-topic participants MedvedevDev , Vadim Ovchinnikov , Air , andreymal , nörbörnën May 27 '18 at 9:06

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Vadim Ovchinnikov, andreymal, nörbörnĂ«n
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • That is, seriously, at the request of the type "css / html text in the center" did not find anything? Little hard to believe. - MedvedevDev
  • text-align: center; however, if the block is centered, then margin: auto; - HamSter

2 answers 2

The topic is really trashed on thousands of resources, but since here they are looking for an answer:

 * { margin: 0; padding: 0; } body, html { height: 100%; } .container { display: flex; align-items: center; justify-content: center; height: 100%; } 
 <div class="container"> <p>Lorem ipsum</p> </div> 

    For text alignment, text-align with center is responsible.