Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

centre align div when position:absolute; 1

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
HI,

Is it possible to centre align a div with
Code:
#mydiv {
position:absolute;
margin:0 auto;
display:none;
width:600px;
}

It seems the auto is not applied, i'm assuming due to the absolute, but using absolute is the only way to float a hidden div over the top of existing content to create an on page popup form.

Well it's the only way I know, any one got a better way or how I can centre align the div.

Thanks.
1DMF


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Thanks, new it had to be some conveluted way to achieve it, any reason the auto won't work, is this part of the W3C (it's meant to work that way) standards or somethig else.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top