2011-09-19 49 views
0

您好,我试图找出如何上传我的工作在线进行,但无法找到一个简单的免费虚拟主机上传我的HTML和CSS ...所以我提供了另一个截图。我希望我的问题不会太让人烦恼 - 到目前为止,你们的帮助已经很棒了。不覆盖整个地点的边界 - 元素流失?

http://postimage.org/image/27n77o1xg/

我目前遇到的问题是,在我的身体的边界并不概述一切。正如我最近了解到的,我猜这意味着一个元素由于浮动而流出?但是我不确定如何解决这个问题。

我的HTML是:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 

<head> 
    <link rel="stylesheet" type="text/css" href="swaggersstyle.css"> 
     <title>Oamaru Backpackers Hostel, Swaggers Backpackers - Home</title> 


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> 
<!-- include Cycle plugin --> 
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script> 
<script type="text/javascript"> 
$(document).ready(function() { 
    $('.slideshow').cycle({ 
     fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
    }); 
}); 
</script> 
</head> 


<body> 
    <img src="final.jpg" id="banner"> 
    <ul id="nav"> 
     <li class="links"><a href="index.html">Home</a></li> 
     <li class="links"><a href="planning.html">Location</a></li> 
     <li class="links"><a href="construction.html">Facilities</a></li> 
     <li class="links"><a href="evaluation.html">Attractions</a></li> 
     <li id = "endlink"><a href="evaluation.html" id="lastlink">Bookings</a></li> 
    </ul> 


<div id="leftcolumn"> 
<p>hghadgadgadg</p> 
<p>easfasf</p> 
<p>safSFS</p> 
<p>afafafadf</p> 
<p>safasf</p> 
<p>saasfasf</p> 
<p>fasfsaf</p> 
</div> 

<div id="mainc"> 

    <p>Make Yourself at Home</p> 
    <p>Swaggers Backpackers is a converted old house located within  walking distance of all the best parts of Oamaru. Explore the old victorian era buildings and shops of the city centre, or see the penguin colonies down the street. Swaggers is owned and operated by camp mum Agra, who makes all guests feel welcome, informed, and perhaps a bit mothered. </p> 

    <div class="slideshow"> 
     <img src="1.jpg" width="600" height="450" /> 
     <img src="2.jpg" width="600" height="450" /> 
     <img src="3.jpg" width="600" height="450" /> 
    </div> 


</div> 



<div id ="footer"> 
<p> fsafasfasf </p> 
</div> 

</body> 
</html> 

和我的CSS是:提前家伙

html{ 
    font-family: sans-serif; 
    background-color:#464E54; 
    height: 100%; 
} 

body{ 
    width: 960px; 
    margin: auto; 
    background-color: white; 
    border: 3px solid black; 
    padding: 0; 
    height: 100%; 
} 

#banner{ 
    padding: 0px; 
    margin: 0; 
    display: block; 
} 

#nav { 
    list-style-type: none; 
    padding: 0px; 
    margin: 0px; 
    overflow: hidden; 
    border-bottom: 1px solid #7f7f7f; 
    border-top: 1px solid #7f7f7f; 

} 

#mainc { 
    float: left; 
    width: 654px; 
    background-color: white; 
    margin: 0; 
    padding-left: 8px; 
    padding-right: 4px; 
    height: 100%; 
} 

#leftcolumn { 
    padding-left: 3px; 
    float: left; 
    background-color: #dad8bf; 
    width: 290px; 
    border-right: 1px solid #7f7f7f; 
    height: 100%; 
} 

#footer { 
    clear: both; 
    position: relative; 
    bottom: 0.5px; 
    margin: 0; 
    background-color: #dad8bf; 
    border-top: 1px solid #7f7f7f; 
} 

#footer p{ 
    margin: 0; 
} 

.links { 
    float: left; 
    margin: 0px; 
    border-right: 1px solid #7f7f7f; 
} 

#endlink { 
    float: left; 
    margin: 0px; 
    border-right: none; 
} 

#lastlink{ 
    display: block; 
    width: 184px; 
    font-weight: bold; 
    color: #444444; 
    background-color: #dad8bf; 
    text-align: center; 
    padding: 4px; 
    text-decoration: none; 
    text-transform: uppercase; 
    margin-top: 0px; 
} 

#lastlink:hover{ 
    background-color: #999999; 
} 

a:link { 

    display: block; 
    width: 183px; 
    font-weight: bold; 
    color: #444444; 
    background-color: #dad8bf; 
    text-align: center; 
    padding: 4px; 
    text-decoration: none; 
    text-transform: uppercase; 
    margin-top: 0px; 
} 

a:visited { 

    display: block; 
    width: 183px; 
    font-weight: bold; 
    color: #444444; 
    background-color: #dad8bf; 
    text-align: center; 
    padding: 4px; 
    text-decoration: none; 
    text-transform: uppercase; 
    margin-top: 0px; 
} 

a:hover { 
    background-color: #999999; 
} 

a:active{ 
    background-color: #999999; 
} 

.slideshow { 
    height: 483px; 
    width: 632px; 
    margin: auto; 
    padding: 0px; 
} 

.slideshow img { 
    padding: 0px; 
    border: 1px solid #ccc; 
    background-color: #eee; 
} 

谢谢!

+0

你”对于多种样式,仍然使用'float'属性。 –

回答

5

发生这种情况,因为你的身体已经修复100%.Change body标签CSS的高度:

height:auto; 
min-height: 100% 

如果不工作,然后添加与此以下:

overflow:auto; 
+0

嘿伙计我加了这段代码,现在我有以下内容:http://postimage.org/image/2e6gj4rj8/ – AndyNZ

+0

它已经修复了边界问题,但是我现在需要的是左列填充整个长度该页面也。 – AndyNZ

+0

你最低身高打破了身高百分比的任何孩子。你应该重做你的设计,给内容区域一个边框,内容的白色背景和一般的棕色背景,所以它会显示在菜单 –

0

添加溢出:隐藏到您的身体元素。当元素浮动时,除非有更清晰的元素,否则不会将父容器高度推过它。

1

可能最好不要将body元素用于您的容器。相反,只需添加

<div class="container"></div> 

在你的代码,并在你的CSS改变htmlbodybodydiv.container

body{ 
    font-family: sans-serif; 
    background-color:#464E54; 
    height: 100%; 
} 

div.container{ 
    width: 960px; 
    margin: auto; 
    background-color: white; 
    border: 3px solid black; 
    padding: 0; 
} 

编辑:我完全错过了100%,这得是它。

+0

嘿伙伴我改变了我的代码,你已经建议,我已经结束了这个结果(同上): – AndyNZ

+0

http://postimage.org/image/2e6gj4rj8/你对我最好的选择使我的意见是什么左栏落在页面的整个长度上?干杯 – AndyNZ