'CSS floating issue id div [duplicate]
How could I centralize all the elements vertically and horizontally? I tried to fix the div placement horizontally by using CSS float but it too disturbing for me now. Does there any perfect and useful solution. Please help me. I also want them in center
Solution 1:[1]
Using
margin: 0 auto;
should work to keep everything centered. For more detailed answer go here: https://stackoverflow.com/questions/7217315/html-css-content-always-centered#:~:text=If%20you%20want%20elements%20always,in%20the%20styles%20on%20it.&text=To%20get%20background%20elements%20to,the%20same%20style%20as%20above.
Solution 2:[2]
take a parant div and set it css
div {
display: flex;
justify-content: center;
align-items: center;
}
if don't work just
div{
margin:auto;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mats Janssens |
| Solution 2 | Moniruzzaman |
