Sunday, January 18, 2009

How to Position HTML DIV tag at the Center?

Following StyleSheet class will position the DIV tag at the center of the screen. This is often required when showing the "Please Wait..." or "Processing..." message while processing Ajax request.


DIV.centered
{
border: 0;
background-color: #6095b3;
height: 10%;
width: 20%;
position: fixed;
_position: absolute;
left: 40%;
top: 40%;
color: black;
z-index: 100;
}
Your comments are always welcome !

8 comments:

kahai said...

ZOMG!

Thank you!

totally needed that, so if i use % instead of number of px, ill be fine, sweet

thankies!

^__^

Pamela Scout said...

I had no idea before going through your blog that DIV can be used in such a way.Thanks for your trick and hope to receive new tips soon. Thank from pamela.

Sara said...

In web2 standard, now a days div can be a substitute of many tags. So please highlight those areas in your new post to show the power of div tag and its usefulness in search engine.

Dhirendra said...

Thanks a lots

seo melbourne said...

Exactly nice explanation on the div tag. Through above code we can set in center div tag.

India web developers said...

Hello, Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic.

Anonymous said...

Excellent!!!Thank you!

website design company said...

I wanted to thank you for this great blog! I really enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

Post a Comment