26 Answers
New Answer5/24/2022 11:20:15 AM
Alpesh Solanki26 Answers
New AnswerHTML Give your main div a class. It can be any name you want but I choose center. <div class="center"> In your CSS tab or in your <style> element add this: .center{ margin:auto; } https://code.sololearn.com/WsxlOq6Td9Qx/?ref=app
What exactly do you want to center? The div? Try to set div's margin to auto in order to center horizontally.
The text already is centered horizontally. Do you want to center the text vertically? Or do you want to center the divs vertically or horizontally on the page? Please be precise.
body { text-align: center; } div { /*width: 300px; height: 300px;*/ background-color: aquamarine; }
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message