2017-03-24 125 views
0

我的網站設計和佈局存在很多問題。我已經修復了其中的大部分,但其中一個仍然存在:我的側面導航欄不佔用文本容器的整個高度(或超出大小)。我希望通過添加一箇中間容器並將側邊導航設置爲有一個高度:100%可以做到這一點,但事實並非如此。側邊導航欄未填滿全高

[代碼]

<html> 
<head> 
<title>Home </title> 
<link rel="stylesheet" type="text/css" href="./main.css"> 
<link rel="icon" href="./ski_icon.png"> 
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 
<script src="jquery-3.0.0.min.js" type="text/javascript"></script> 
</head> 
<body> 
<div id='content'><div id='logo'><img src='./logo.png'></img></div><div id='container'><nav id='hor'><ul><li><a href='./index.php'> Home </a> </li><li><a href='./mountains.php'> The Mountains </a></li><li><a href='./resorts.php'> The Resorts </a></li><li><a href='./snowreports.php'> Snow Reports </a></li><li class='dropdown' id='Events'><a href='javascript:void(0)' class='dropbtn' id='events2' onclick='showEAndADropdownHor()'> Events &amp Activities <i class='fa fa-angle-down'></i></a><div class='dropdown-content' id='eAndADropdown'><ul><li><a href='./eventsandactivities.php'> Main </a></li><br/><li> <a href='./foggyGoggle.php'> Foggy Goggle </a></li><br/><li><a href='./lessons.php'> Ski Lessons </a></li></ul></div> 


</li><li><a href='./plantrip.php'> Plan A Trip </a></li><li><a href='./contactus.php'> Contact Us </a></li><li><a href='./findus.php'> Find Us </a></li><li class='dropdown' id='Restaurants'> <a href='javascript:void(0)' class='dropbtn' onclick='showRestaurantDropdownHor()'> Restaurants <i class='fa fa-angle-down'></i></a><div class='dropdown-content' id='restaurantDropdown' style='z-index: 1;'><ul style><li><a href='./grandviewbistro.php'>Grand View Bistro</a></li><br/><li><a href='./angelescrestcafe.php'>Angeles Crest Caf&eacute</a></li><br/> <li><a href='./goldrushgrill.php'>Goldrush Grill</a></li><br/><li><a href='./bullwheelbarandgrill.php'> Bullwheel Bar &amp Grill </a></li><br/><li><a href='./bigpinesbarbecue.php'> Big Pines Barbecue </a></li><br/><li><a href='./northpolegrill.php'> North Pole Grill </a></li></ul></div> 

</li></ul></nav><div id='middleContainer'><div id='middle'><nav id='vert'><ul><li><a href='./index.php'> Home </a></li><li><a href='./mountains.php'> The Mountains </a></li><tr><td><li><a href='./resorts.php'> The Resorts </a></li></td></tr><li><a href='./snowreports.php'> Snow Reports </a></li><li class='dropdown' id='ead2'><a href='javascript:void(0)' class='dropbtn' onclick='showEAndADropdownVert()'> Events &amp Activities <i class='fa fa-angle-right'></i> </a><div class='dropdown-content' id='eAndADropdown2'><ul id='sb'><li><a href='./eventsandactivities.php'> Main </a></li><li> <a href='./foggyGoggle.php'> Foggy Goggle </a></li><li><a href='./lessons.php'> Ski Lessons </a></li></ul></div></li> 
<script> 

function changePage() 
{ 





window.location.href= "./findus.php"; 

} 

</script> 

<li><a href='./plantrip.php'> Plan A Trip </a></li><li><a href='./contactus.php'> Contact Us </a></li><li onclick='changePage()'><a href='./findus.php'> Find Us</a></li><li class='dropdown'> <a href='javascript:void(0)' class='dropbtn' onclick='showRestaurantDropdownVert()'> Restaurants <i class='fa fa-angle-right'></i></a><div class='dropdown-content' id='restaurantDropdown2'><ul><li><a href='./grandviewbistro.php'>Grand View Bistro</a></li><li><a href='./angelescrestcafe.php'>Angeles Crest Caf&eacute</a></li> <li><a href='./goldrushgrill.php'>Goldrush Grill</a></li><li><a href='./bullwheelbarandgrill.php'> Bullwheel Bar &amp Grill </a></li><li><a href='./bigpinesbarbecue.php'> Big Pines Barbecue </a></li><li><a href='./northpolegrill.php'> North Pole Grill </a></li></ul></div></li></ul></nav> 

<style> 

img 
{ 
width: 250; 
height: 250; 
border: 1px solid black; 

} 

</style> 

</div> 



<div id="text-container"> 

<h1> Home</h1> 

<p> Looking for an exciting day of fun? Then you've come to the right place! Diamond Peaks Resort is rated #1 by the All-American Skiing Association. 
With three different resorts, there is enough variety to please everyone. </p> 

<img src="./image2.jpg"></img><img src="./image5.jpg"></img><img src="./image3.jpg"></img><br/> 
<img src="./image6.jpg"></img><img src="./image7.jpg"></img><img src="./image12.jpg"></img><br/> 


    </div> 
</div> 
</div> 


<div id='footercontainer' style='height: 90px;'><footer style='height: 90px;'> 
<style> 

a.twitter-share-button 
{ 
color: white; 

} 

footer table.right td 
{ 
background-color: rgb(223,223,223); 

} 

footer table.left td 
{ 
font-family: "Impact", Times, serif; 
font-size: 14px; 
color: white; 


} 


footer table.left td a 
{ 
color: white; 
font-family: "Impact", Times, serif; 
font-size: 14px; 

} 

</style> 
<div style='float: left;'>1234 Easy Street San Gabriel, CA <br/>Copyright &copy; 2016 Dimaond Peaks Resort, &nbsp; All Rights Reserved. <br/><a href='http://www.allwebpromotion.com/' target='_blank'>Website Design</a> by: All Web Promotion</div><div style='float:right; color: black;'><a href='https://twitter.com/share' class='twitter-share-button' data-text='Come to Diamond Peaks Resort and enjoy the fun!' data-size='large'>Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> 







</div> 
<br/> 
</div> 
</footer></div></div> 

</body> 
</html> 

[/代碼]

[代碼]

#logo 
{ 

border: 1px dashed purple; 
width: 1050; 
height: 75; 

} 

#logo > img 
{ 
width: 1050; 
height: 75; 

} 

footer a 
{ 

color: white; 


} 

.floatleft 
{ 
float: left; 

} 


.floatright 
{ 
float: right; 

} 

#content 
{ 

// border-left: 3px solid #283379; 
    border-right: 3px solid #283379; 
    text-align: left; 
    margin: 0 auto; 


max-width: 960px; 
    background-color: #ffffff; 
    background-repeat: repeat-y; 
    height: auto; 





} 



nav#hor ul li ul 
{ 
overflow-y: auto; 



} 

nav 
{ 


     border: 10px solid transparent; 
padding: 15px; 
    border-image-source: url(./blue-diamond.gif); 
    border-image-repeat:repeat; 
    border-image-slice: 30; 

background-color: 2211ff; 
font-family: "Impact", Times, serif; 
font-size: 110%; 

} 

nav#vert 
{ 

width: auto; 

    height: 100%; 

    margin: 0px; 
//display:table-cell; 
// float: left; 
font-size: 100%; 

} 

nav#hor ul li ul li 
{ 

width: 100%; 

} 

.dropdown ul li 
{ 
width: 100%; 

} 


.dropdown-content ul li 
{ 
width: 100%; 


} 






body { 
    color: #000000; 
    margin: 0; 
    padding: 0; 
    font-family: Helvetica, Arial, sans-serif; 
    font-size: 16px; 
    background-color: #422520; 
    background-image: url(./snow_mountain.jpg); 
    background-repeat:no-repeat; 

    background-size:cover; 
    text-align: center; 
    background-attachment: fixed; 
    background-position: center; 
} 

#footerContainer 
{ 

//border-left: 3px solid #283379; 
    border-right: 3px solid #283379; 
    text-align: left; 
    margin: 0 auto; 
    width: 980px; 
    background-color: #ffffff; 
    background-repeat: repeat-y; 
height: 150px; 


} 

footer 
{ 

    border: 10px solid transparent; 
padding: 15px; 


    text-align: left; 
    margin: 0 auto; 
    width: 1000px; 

    background-repeat: repeat-y; 

    border-image-source: url(./blue-diamond.gif); 
    border-image-repeat:repeat; 
    border-image-slice: 30; 

background-color: 2211ff; 
font-family: "Impact", Times, serif; 
font-size: 14px; 
color: white; 


} 

footer table.left td 
{ 
font-family: "Impact", Times, serif; 
font-size: 14px; 
color: white; 


} 


footer table.left td a 
{ 
color: white; 
font-family: "Impact", Times, serif; 
font-size: 14px; 

} 

#container 
{ 
// border-left: 3px solid #283379; 
    border-right: 3px solid #283379; 
    text-align: left; 
    margin: 0 auto; 
    width: 1050px; 
    background-color: #ffffff; 
    background-repeat: repeat-y; 
    height: auto; 
// max-width: 960px; 




} 


nav > a 
{ 

color: #ccccff; 

} 

nav#hor > div 
{ 

border: 1px solid white; 
float: left; 
padding: 10px; 
background-color: #000044; 
} 

nav#hor 
{ 
max-width: 1000px; 
//width: auto; 
height: 50px; 
margin: 0; 
font-size: 100%; 
//width: 960px; 

} 


nav#hor a 
{ 

//color: rgb(0 0,238); 
color: white; 
} 


nav#hor > div > a 
{ 

color: #ccccff; 
text-decoration: none; 
font-size: 100%; 
} 



nav#hor>div:hover 
{ 

background-color: #018802; 

} 

h1 
{ 
font-family: "MV Boli", Times, Serif; 

font-style: bold; 
text-align: center; 
font-size: 36px; 

} 

h2 
{ 

font-family: "MV Boli", Times, Serif; 
font-style: bold; 
text-align: center; 
font-size: 26px; 
} 

h3 
{ 

font-family: "MV Boli", Times, Serif; 
font-style: bold; 
text-align: center; 
font-size: 20px; 
} 




#text-container 
{ 



height: 100%; 
width: auto; 

border: 2px solid cyan; 




    */ zoom: 1; 
    */ margin: 0; 
    display: table-cell; 


padding-top: 10px; 
    padding-right: 10px; 
    padding-bottom: 10px; 
    padding-left: 10px; 




} 


nav#hor li 
{ 

width: auto; 


} 

#text-container:after 
{ 
clear: both; 
    content: "."; 
    display: block; 
    height: 0; 
    visibility:hidden; 

} 

#text-container p 
{ 
font-family: "Myriad Web Pro", Times, Serif; 
font-size: 18px; 
} 

.left img 
{ 

float: left; 
padding: 0 20px 20px 0; 

} 






.left > p 
{ 
font-family: "Myriad Web Pro", Times, Serif; 
font-size: 18px; 
} 


.right img 
{ 
float: right; 
    margin: 0px 0px 15px 20px; 
    border: 1px solid transparent; 

} 



.right p 
{ 
font-family: "Myriad Web Pro", Times, Serif; 
font-size: 18px; 
} 


nav#hor ul 
{ 
list-style-type: none; 
    margin: 0; 
    padding: 0; 
background-color: #000044; 
    z-index: 1; 

    width: auto; 
    overflow: hidden; 






} 

nav#hor ul li:hover 
{ 
    background-color: #018802; 

} 







nav#vert ul 
{ 
list-style-type: none; 
    margin: 0; 
    padding: 0; 
    // overflow: auto; 
    background-color: #000044; 
     height: auto; 



} 

nav#vert li a 
{ 
display: block; 

} 
nav#hor ul li 
{ 
float: left; 
border: 1px solid white; 
z-index: 1; 
width: auto; 


} 

nav#vert ul li 
{ 
//float: left; 
border: 1px solid white;. 
z-index: 1; 
position: relative; 


} 

nav#vert a 
{ 
color: white; 

} 

#middle 
{ 
height: 100%; 
float: left; 

width: auto; 

display: table-cell; 

} 




nav#vert ul li ul 
{ 
//left: 100%; 

//left: 25; 
//right:: 150; 
//left: 215px; 
//right: 20%; 

//top: 100%; 
// left: 0; 
    //right: 100%; 
    //right: -50px; 
    //bottom: 100%; 
    //top: 0; 
    //float: right; 
    //right: -100px; 

top: -36px; 
left: 90%; 



position: absolute; 
//height: 164px; 
height: auto; 


} 




nav#vert li a, .dropbtn { 
    display: inline-block; 
    // color: white; 
    text-align: center; 
    padding: 8px 8px; 
    text-decoration: none; 
} 


nav#hor li a, .dropbtn { 
    display: inline-block; 
    // color: white; 
    text-align: center; 
    padding: 8px 8px; 
    text-decoration: none; 
} 

nav#vert li:hover 
{ 
background-color: #018802; 

} 

nav#hor li a:hover, .dropdown:hover .dropbtn { 
background-color: #018802; 

} 

nav#vert li a:hover, .dropdown:hover .dropbtn { 
    background-color: #018802; 
} 


li.dropdown { 
    display: inline-block; 
} 



.dropdown-content ul 
{ 

z-index: 1000; 


} 
.dropdown-content { 
    display: none; 
    position: absolute; 
    background-color: #f9f9f9; 
    min-width: 160px; 
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 
     color: rgb(0, 0, 238); 
    z-index: 1000; 



} 

.dropdown-content-side 
{ 


} 

#eAndADropdown 
{ 

} 

#eAndADropdown2 
{ 

} 


#eAndADropdown ul li 
{ 
background-color: #000044; 
border: 1px solid white; 

} 

#restaurantDropdown ul li 
{ 
background-color: #000044; 
border: 1px solid white; 

} 

#restaurantDropdown ul 
{ 
border: 1px solid white; 

} 

#eAndADropdown ul 
{ 
border: 1px solid white; 

} 


#eAndADropdown:hover 
{ 
    background-color: #018802; 

} 

#restaurantDropdown:hover 
{ 
    background-color: #018802; 

} 

#eAndADropdown a 
{ 
    color: rgb(0, 0, 238); 

} 

#restaurantDropdown a 
{ 
    color: rgb(0, 0, 238); 

} 

.dropdown-content a { 
    color: rgb(0, 0, 238); 
    border: 1 px solid white; 
    padding: 12px 16px; 
    text-decoration: none; 
    display: block; 
    text-align: left; 
} 



.dropdown-content a:hover {background-color: #f1f1f1} 

.show {display:block;} 

li a 
{ 

color: rgb(0, 0, 238); 

} 

[/代碼]

順便說一句,我想知道如果我顯示:表細胞;對於nav#vert(或者它是#middle)和#文本容器來嘗試修復一個問題,而不會爲#文本容器填充(儘管它破壞了其他一些內容,但我認爲我修復了這個問題通過做一些調整,至少,我想我修好了。無論如何,我想知道,如果我的顯示器:表格單元格是導致混亂的原因或是其他東西?)

+1

請將您的代碼降低到顯示問題所需的最低數量。通常這會神奇地向你揭示答案,併爲你節省來到這裏的麻煩。如果沒有,它可以幫助我們更容易地發現問題,因爲沒有其他問題。此外,請格式化您的代碼(縮進,沒有多餘的空間),以便我們可以閱讀它。 –

+0

我已經刪除了一些不需要的東西。 – MongooseLover

+0

嗯,會計算工作嗎? – MongooseLover

回答

1

你的目標是什麼?在側杆上實現藍色?如果是這樣的話。 加到middleContainer背景:#21f; 和文本容器 background:#fff;

更新: 您還沒有宣佈middleContainer元素。將元素添加到您的css可能會解決您的問題。

#middleContainer { 
    height: 100%; 
} 
+0

不,我的左側導航欄不是要下到頁腳就是要進入頁腳。我認爲添加中間容器和高度100%會解決它,但不要猜測。 – MongooseLover

+0

這可能是因爲100%的東西無法正常工作。 – MongooseLover

+0

看看上面的更新。 –