+ 3
[SOLVED] Center a DIV Both Vertically & Horizontally
I Need to put a Div Element in middle of the screen. Means Both Vertically & Horizontally, Using Bootstrap. Can anyone help me with this? It will be much helpful if anyone give me the code. Because I am in a hobby project and need to make it done ASAP.
2 Réponses
+ 9
without bootstrap etc.... :
body, html {
width: 100%;
height: 100%;
}
div {
width: ;//your width
height: ;//your height
background-color: ; //bg color
margin: 50%;
-webkit-transform: translate (-50%);
}
you must to make a width and a height to your div. the bgcolor is to see the div.
+ 3
@Noxfly Thanks for your reply 😃 But this isn't working.
Screenshot: http://i.cubeupload.com/y5Cp9C.png
This is happening.
(I Haven't used Bootstrap with it)