2011-09-19 32 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