3 amazing tricks to center a div using CSS | @coderamjad
Folder Structure
In the folder we can see that we have two files
- HTML File
- CSS File
Basic File Code
HTML File
In the markup file I have simply html boiler plate which you can see in the image below
HTML File
and in the css file i have basic codeFirst Trick (flex box)
In the CSS 3 we have amazing feature called flex box with this we can simply create web designs we can simple center a div using flexbox which you can see in the image below
you can see that we can simply center a div using 3 properties and it is a very handy trick.
Second Trick (using positions)
We can also simply center a div using positions but it is a complex trick
In this trick we can simply center a div using four peripteries
Third Trick (grid system)
we can also center a div using grid system of css and it is the most powerful feature of css we can simple center a div using only two properties which you can see in the image below
Thanks for reading !!!!!
Leave 3 amazing tricks to center a div using CSS | @coderamjad to:
Read more #hive-150329 posts
Best Posts From Amjad
We have not curated any of coderamjad's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Amjad
- Male DNA
- Beautiful lesson
- ๐ *Anecdote* ๐
- Unparalleled habits of the Ottomans
- Beautiful Story of my closest friends from teenage to adult life
- Honesty and unemployment ๐
- The love of a boy , Girl and a shemale
- The power of prayer
- A morning incident ๐ | @coderamjad
- A sad ๐ and a real story | @coderamjad