Hello! How to arrange the text in the layout?
2 answers
Example
* { padding: 0; margin: 0; box-sizing: border-box; } body{ padding-top: 70px; } .container { max-width: 700px; margin: 25px auto; } .container-row { display: flex; margin-bottom: 10px; } .item { width: 50%; padding: 10px; } .item:nth-of-type(1) { text-align: right; } <div class="container"> <div class="container-row"> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> </div> <div class="container-row"> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> </div> <div class="container-row"> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> </div> </div> - Thanks, that time you help me) - Nikita Knyazev
|
You can do without flex (refined the code from the @ soledar10 response ):
* { padding: 0; margin: 0; } body{ padding-top: 70px; } .container { display: table; max-width: 700px; margin: 25px auto; } .container-row { display: table-row; margin-bottom: 10px; } .item { display: table-cell; width: 50%; padding: 10px; } .item:first-child { text-align: right; } <div class="container"> <div class="container-row"> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> </div> <div class="container-row"> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> </div> <div class="container-row"> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> <div class="item">ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅? ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΠ°ΠΊ ΡΠ°ΡΠΏΠΎΠ»ΠΎΠΆΠΈΡΡ ΡΠ΅ΠΊΡΡ ΠΊΠ°ΠΊ Π² ΠΌΠ°ΠΊΠ΅ΡΠ΅?</div> </div> </div> |
