To Horizontaly centered the <div> Element :
- We can use the property of margin set to auto i.e margin:auto;.
- The <div> Element takes up its specified width and divide equally the remaining space by the left and right margins.
Supported Browsers: The browser supported by margin:auto property are listed below:
- Apple Safari
- Google Chrome
- Internet Explorer
- How to make an image center-aligned (vertically & horizontally) inside a bigger div using CSS?
- Make a div horizontally scrollable using CSS
- How to center a div within another div?
- How to vertically and horizontally align flexbox to center ?
- How to center absolutely positioned element in div using CSS ?
- Differences between HTML <center> Tag and CSS "text-align: center;" Property
- How to overlay one div over another div using CSS
- How to split text horizontally on mouse move over using CSS ?
- How to copy the content of a div into another div using jQuery ?
- How to clear all div's content inside a parent div ?
- How to Horizontally Flip a Text Canvas using Fabric.js ?
- How to align a logo image to center of navigation bar using HTML and CSS ?
- Making a div vertically scrollable using CSS
- How to align content of a div to the bottom using CSS ?
- How to auto-resize an image to fit a div container using CSS?
- How to give a div tag 100% height of the browser window using CSS
- How to place two div side-by-side of the same height using CSS?
- How to position a div at the bottom of its container using CSS?
- How to make div not larger than its contents using CSS?
- How to float three div side by side using CSS?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.