- Forums
- CSS
- How Do I Make A Div Tag Center In Css
This Tutorial Will Show You About Centering A Div Using Css And Html With Sample Easy Code [3350], Last Updated: Mon Jun 24, 2024
Webune Support
Wed Oct 21, 2009
3 Comments
512 Visits
Welcome to Webune Forums. Webune Has many web hosting solutions including website design.
if you are visiting our post its probably because you want to know how you can make a div center in the middle.. right?
well, if you do, you are in luck because here at Webune, we will show you.
lets say for example you have this code:
HTML CODE:
<div align="center">Put me in the center</div>
ok, as you can see at the code above, it puts that div in the center of the page.
how can you do it with css?
ok, you can do it this way:
HTML CODE:
<div style="text-align:center">Put me in the center</div>
but i find that the most effective way for centering a div is this way:
HTML CODE:
<div style="margin:0 auto;">Put me in the center</div>
depending on what you want to do, you have three choices now and three different ways to center a div using HTML or CSS
as you can see, our prefer way is the center div margin 0 auto way.. but you have to center div using css. you can also do div margin left but that will only work on a div margin right when a div is align left. another useful way to center div horizontally is to center acontainer div in the center div vertically of the page.
hope that helps
Webune Support Team
muslimahbutik
https://www.webune.com/forums/how-do-i-make-a-div-tag-center-in-css.html