locked
Central align Div RRS feed

  • Question

  • User-614943948 posted

    I am using this source code for but i am unable to center the contents of the div.

    <div style="margin-left: 10px; margin-top: 10px; font-size: large; width:100%; align-content:center">
            <b style="color: #284775">User Registration</b>
            <hr />
    </div>

    Friday, August 31, 2018 7:18 AM

Answers

  • User475983607 posted

    There are several ways to accomplish this design. 

    Since you are trying to align text then...

    text-align:center;

    align-content is used in flex-wrap elements which you are not using. 

    If I can make a suggestion.  When a language feature does not work as expected, take a moment to looking and read the support doc.  

    https://www.w3schools.com/cssref/css3_pr_align-content.asp

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 31, 2018 11:07 AM