我正在使用此 CSS 代码并排显示 2 个 div:
#contactus-menu {
width:20%;
float:left;
display:inline;
}
#contactus-main {
width:75%;
float:right;
display:inline;
}
然后是我的 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>sales@domain.co.uk
<p> </p><p> </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> </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>
但是由于#contactus-main
某种原因,DIV 在我的页脚下显示,任何想法我做错了什么。页脚没有任何问题,因为它在所有其他页面上都可以正常工作,只是这个页面有一些额外的 div。