Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-17-2011, 05:11 PM   PM User | #1
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
vertical align?

So i usually never have a need for this; but i got bored today and decided to "play around" with an alternative i have read about to vertically align a div (note i usually do via other means)... first the code

Code:
<html>
<head>
<title>Starbuzz Coffee</title>
<style type="text/css">
#one{
width:100%;
height:50px;
background:blue;
}
#main{
display:table-cell;
vertical-align:middle;
width:300px;
height:200px;
background:orange;
border:1px solid black;
}
</style>
</head>


<body>

<div id="main">
<div id="one">text to be centered
</div>
</div>

</body>
</html>
so the only issue i have is with IE... FF and chrome both apply the "trick" but IE(9) completely ignores it. has anyone fiddled with this and know why it is not working? or an "hack" to make IE recognize?
Again not really "high priority" i just got bored/distracted this morning. Also please no spams of things like
"don't use IE" or
"force users to use something other than IE" or
well, you get the point.
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Old 07-17-2011, 09:24 PM   PM User | #2
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
I never use vertical-align

hopefully this bump will help get an answer
I know it could be very handy esp. when you want something vertically centered.
Sammy12 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:43 PM.


Advertisement
Log in to turn off these ads.