How to make a div center align in HTML?

HTMLWeb DevelopmentFront End Technology

To center div element center ,you can use "div style="text-align:center" " and to center the div ,use "div style="margin: 0 auto" "

In your code, the above css will be written as −

<div style="text-align:center;width: 300px;margin: 0 auto;border-style: dotted;">
<p>hi</p>
</div>
raja
Published on 01-Oct-2018 11:23:29
Advertisements