Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Vertical Centering problem
Old 03-04-2010, 10:26 AM Vertical Centering problem
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
I am having trouble centering a div vertically, as seen here (I've set #wrapper to have a red background and .section1 to be blue to outline the two):

I am having different problems in FF and Safari. Shockingly, it works fine in IE.

Firefox: When the paragraph fades out and the new one fades in, the whole thing (.section1) seems to shift down. There appears to be no margins set in Firebug so I cannot understand why this is happening.

Safari: There is a horizontal scroll bar, with room to scroll to the right. I assume this is due to the width, position and margins of #wrapper, however I read a tutorial saying how to vertically centre absolutely positioned elements and supposedly it's cross browser compatible?

Here is my code:
HTML:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript" src="scripts/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="scripts/pngFix.js"></script>
    <script type="text/javascript" src="scripts/splash.js"></script>
    <link rel="stylesheet" href="css/thehelpagency-intro.css" type="text/css" />
    <title>That Day Has Arrived | ******</title>
</head>
<body onload="buttontest();">
    <div id="wrapper">
        <div id="section1">
            <div id="splashcontainer">
                <div id="splash1"><div class="anibox"><img src="templateimages/intro1.png" alt="The" /></div></div>
                <div id="splash2"><img src="templateimages/intro2.png" alt="Help" /></div>                
                <div id="splash3"><div class="anibox"><img src="templateimages/intro3.png" alt="Agency" /></div></div>
                <div class="clearer"></div>
            </div>    
            <div id="intro-text">
                <p>Did you ever think you would see the day when an advertising and marketing company was created that was open, honest, generous and had a conviction to help orgnisations that helped others?</p>
                <p>And shared its success with those organisations?</p>
            </div>
            <div id="final-text">
                <p class="day-arrived">That day has arrived.</p>
                <p><a href="home.aspx"><img id="help-button" src="templateimages/btn-help.gif" alt="That Day Has Arrived" /></a></p>
            </div>            
        </div>
    </div>
</body>
</html>
CSS:
Code:
/* general styles */

* {
    margin: 0;
    padding: 0;
    outline: none;
}

html, body {
    height: 100%;
}

body {
    font-family: arial, sans-serif;
    color: #222;
    font-size: 16px;
}

p {
    margin: .25em 0 .5em;
    line-height: 1.5em;
    color: #333;
}

.clear {
    clear: both;
}

.day-arrived {
    margin-top: 50px;
    text-align: center;
}

.highlight {
    color: #a2224e;
}

.nolink {
    text-decoration: none;
    color: #333;
}

.clearer {    
    clear:both;
}


/* div id */

#wrapper {
    width: 920px;
    margin: -150px 0 0 -250px;
    background:red;
    position:absolute;
    top:50%;
    left:50%;
    height:300px;
    width:500px
    overflow: auto;
}

#section1 {
    margin:0;
    width: 385px;
    font-family: 'gill sans', arial, sans-serif;
    color: #969696;
    background:blue;
}

#final-text {
    min-height:100px;
}

#help-button {
    display: block;
    margin: 0 auto;    
    border:none 0px #FFFFFF;
}

#splashcontainer {
    width:394px;
}

#splash1 {
    width:100px;
    height:71px;
    float:left;
}

#splash2 {
    width:108px;
    height:71px;
    float:left;
}

#splash3 {
    width:186px;
    height:71px;
    float:left;
}

.anibox {
}

#final-text {
    display:none;
}
Any help is much appreciated
__________________

Please login or register to view this content. Registration is FREE

Last edited by pealo86; 03-04-2010 at 06:02 PM..
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 03-04-2010, 02:18 PM Re: Vertical Centering problem
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
http://www.webmaster-talk.com/css-fo...r-website.html
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-04-2010, 06:02 PM Re: Vertical Centering problem
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
Thanks
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Reply     « Reply to Vertical Centering problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23640 seconds with 12 queries