頁面的導航部分在它下面有一些空白區域。儘管我已將其高度定義爲100%。 我試圖實現導航欄的全高,但由於某種原因,我無法得到它 你能幫我解決它嗎?任何人都可以幫我修復我的CSS?
這裏是我的代碼..
https://codepen.io/Ail/pen/LWygrZ
/*navigation*/
nav {
height: 100%;
}
#navigation {
width: 200px;
padding: 1em 0em;
color: white;
background: #8D0D19;
height: 100%;
float: left;
margin-right: 50px;
margin-bottom: 0px;
bottom: 0px;
}
#navigation a {
text-decoration: none;
width: 100%;
display: block;
padding: 10px;
color: white
}
ul.sections {
padding-left: 0;
list-style: none;
font-size: 18px;
width: 100%;
background-color: #8D0D19;
}
.active {
font-weight: bold;
background-color: #450606;
color: white;
padding: 10px;
}
.active_p {
font-weight: bold;
background-color: #450606;
color: white;
padding: 10px;
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
}
#navigation li {
margin-bottom: 5px;
width: 100%;
}
ul.pages {
padding-left: 2em;
list-style: initial;
font-weight: normal;
color: #D4E6F4;
background: #8D0D19;
margin-top: 25px;
margin-bottom: 25px;
text-decoration: none;
width: 100%;
}
.section_name {
font-weight: normal;
background-color: brown;
color: white;
padding: 10px;
}
.section_name:hover {
font-weight: normal;
background-color: gray;
color: white;
padding: 10px;
}
a {
color: white;
}
a:hover {
color: white
}
.admin_links {
color: cornflowerblue;
}
.admin_links:hover {
color: darkslategrey;
}
/*jumbotron*/
.jumbotron {
margin-bottom: 0px;
}
.msg {
font-size: 16;
color: white;
background-color: green;
border-radius: 7px;
padding: 10px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel=stylesheet href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="jumbotron">
<div class="container-fluid">
<h1>CorpoViz</h1>
</div>
</div>
<nav id=navigation>
<ul class="sections">
<!--COMMENT passed a query string below to identify the section-->
<li>
<!-- below code highlights the current section -->
<a class="section_name" href="?section=1">
About</a>
<ul class=pages>
</ul>
</li>
<!--COMMENT passed a query string below to identify the section-->
<li>
<!-- below code highlights the current section -->
<a class="section_name" href="?section=2">
Projects</a>
<ul class=pages>
<li>
<!-- below code highlights the current page -->
<a href="manage_content.php?page=1">
Project 1</a>
</li>
<li>
<!-- below code highlights the current page -->
<a href="manage_content.php?page=2">
Project 2</a>
</li>
</ul>
</li>
<!--COMMENT passed a query string below to identify the section-->
<li>
<!-- below code highlights the current section -->
<a class="section_name" href="?section=3">
Products</a>
<ul class=pages>
<li>
<!-- below code highlights the current page -->
<a href="manage_content.php?page=3">
Product 1</a>
</li>
<li>
<!-- below code highlights the current page -->
<a href="manage_content.php?page=4">
Product 2</a>
</li>
</ul>
</li>
<!--COMMENT passed a query string below to identify the section-->
<li>
<!-- below code highlights the current section -->
<a class="section_name" href="?section=4">
Others</a>
<ul class=pages>
</ul>
</li>
</ul>
</nav>
<div class="container-fluid" id=main>
<div class="container" id=page style="padding:30px;">
<h2>Create new Section</h2><br>
<form action=create_section.php method=post>
<div class="form-group">
<label style="font-size:18px" for="section_name">Section name </label>
<input type="text" class="form-control" id="section_name" name="section_name" style="width:60%">
</div>
<div class="form-group">
<label style="font-size:18px" for="position">Position </label>
<select class="form-control" id="position" style="width:60%" name=position>
<option value=1>1</option><option value=2>2</option><option value=3>3</option><option value=4>4</option><option value=5>5</option> </select>
</div>
<div class="form-group">
<label style="font-size:18px">Status </label><br>
<label class="radio-inline"><input type=radio name=status class="s_visible" value="1">Visible</label>
<label class="radio-inline"><input type=radio name=status class="s_hidden" value="0">Hidden</label>
</div>
<br>
<input type=submit name="submit" class="btn btn-primary" value="Create Section">
<a href="manage_content.php" class="btn btn-danger">✖ Cancel</a>
</form>
</div>
</div>
你缺少你的一些HTML代碼放在這裏。 –
我爲你創建了一個代碼段,並將不必要的JS註釋掉了,而這些JS不允許在沙箱中運行。你也有兩個jQueries – mplungjan
謝謝@mplungjan –