user2135867
user2135867

Reputation:

CSS Div is hiding under footer

i am using this CSS Code to display 2 divs side by side:

#contactus-menu {
    width:20%;
    float:left;
        display:inline;
}
#contactus-main {
    width:75%;
    float:right;
        display:inline;
}

and then my HTML:

<div id="contactus-menu"><?php include 'contact-us/locations.php'; ?></div>

<div id="contactus-main">
<div id="contactus-title">Leigh-on-Sea, Essex</div>

<div id="contactus-bar">Sales</div>

<div id="contactus-bar-sub">
<strong>Telephone: </strong><?php echo $main_phone_number; ?> (Option 1)
</div>

<div id="contactus-bar-sub">
<strong>Email: </strong>[email protected]
<p>&nbsp;</p><p>&nbsp;</p>
<form method="post" action="main.php">
<input name="name" type="text" id="name" onFocus="if(this.value=='Full Name'){this.value=''}" onBlur="if(this.value==''){this.value='Full Name'}" value="Full Name" size="30" />
<br /><br />
<input name="email" type="text" id="email" onFocus="if(this.value=='Email Address'){this.value=''}" onBlur="if(this.value==''){this.value='Email Address'}" value="Email Address" size="30" />
<br /><br />
<input name="phone" type="text" id="phone" onFocus="if(this.value=='Phone Number'){this.value=''}" onBlur="if(this.value==''){this.value='Phone Number'}" value="Phone Number" size="30" />
<br /><br />
<textarea name="message" cols="30" rows="6" id="message" onFocus="if(this.value=='Message'){this.value=''}" onBlur="if(this.value==''){this.value='Message'}">Message</textarea>
<br /><br />
<input type="submit" name="submit" id="submit" value="Send Message" /><br />
</form>
</div>

<div id="contactus-bar-sub">
<strong>Postal Address</strong>
<p>&nbsp;</p>
<?php
if($main_address1 > '') { echo $main_address1.'<br>'; }
if($main_town > '') { echo $main_town.'<br>'; }
if($main_county > '') { echo $main_county.'<br>'; }
if($main_postcode > '') { echo $main_postcode; }
?>
</div>

</div>

but the #contactus-main DIV is displaying under my footer for some reason, any ideas what i have done wrong. there is nothing wrong with the footer as it is working fine on all other pages, its just this page that has a few extra divs.

Upvotes: 3

Views: 640

Answers (1)

Ben Branyon
Ben Branyon

Reputation: 172

You should use display:block on your divs, because display:inline has no effect on floating elements. Also, you probably need an element with style="clear:both" before the footer.

Upvotes: 3

Related Questions