Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS centering absolutely positioned elements with left: 50% and -33% left margin Reply To: centering absolutely positioned elements with left: 50% and -33% left margin

#173041
Kiran
Participant

Hi,

You can center align a div horizontally and vertically by writing this code in css:

#nameofdiv

{Position: absolute;
Left: 0;
Right; 0;
Bottom: 0;
Top: 0;
text-align: center;
line-height: 50px;
}

Hope this will resolve your problem.