begiPass
begiPass

Reputation: 2174

center div in screen without fixing width and height

I use bootstrap to have a responsive design and I want to center one div in the screen

I tested that :

style="position:fixed;top:50%;left:50%;"

but the top left corner of the div is in the center, I don't want put negative values of margin to make him reponsive

how an I solve this issue

Upvotes: 1

Views: 296

Answers (1)

Vinod VT
Vinod VT

Reputation: 7159

To fix a div at the center use,

style="margin: 0 auto;"

It will align div at the center.

Upvotes: 1

Related Questions