Why is my - flex display not working?

Asked

Viewed 39 times

-2

the HTML code is this- I wanted to put a flex display only in "forms2" for the inputs to be in Row. What should I do?

    <div class="forms1">
        <div class="prontuario"><b>Prontuário:</b> <input type="text"></div>
    </div><!--forms1-->
        
    <div class="forms2">
           <ul>
                <li><b>Nome:</b> <input type="text"></div></li>
                <li><b>CPF:</b> <input type="text"></div></li>
                <li><b>ENDEREÇO:</b> <input type="text"></div></li>
            </ul>
    </div><!--forms2-->

*CSS .forms2{ display: flex; }

1 answer

2

First you need to fix the html structure, you have a lot of Divs closing without opening in Lis. Then you need to apply the style in ul and not in div.

    <div>
    <ul class="forms2">
        <li><b>Nome:</b> <input type="text" /></li>
        <li><b>CPF:</b> <input type="text" /></li>
        <li><b>ENDEREÇO:</b> <input type="text" /></li>
    </ul>
</div>

And now apply the style

.forms2 {
        display: flex;
        flex-direction: row;
    }
  • Thank you very much!

  • @Thiernodia if it worked it would be interesting to mark the answer as correct (:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.