CSS布局主体不出现



我仍在尝试弄乱这种布局东西,只是当我以为我理解它时,我似乎无法显示此div。

我有一个简单的导航和页脚,一个主和主人没有显示。它应该具有黑色背景,但没有出现。这是小提琴:

https://jsfiddle.net/44655gw4/2/

html {
    height: 100%;
}


body{
    height: 100%;
    background-color: #527a7a;
    margin: 0;
    font-family: courier;
    font-size: 19px;
}

* {
margin: 0;
}
#pagewrap {
min-height: 100%;
margin-bottom: -174px;
width: 80%;
}
#pagewrap:after {
content: "";
display: block;
}
#footer, #pagewrap:after {
height: 174px;
}


.sub:last-child {
    border: 0px;
}
#footer {
background-color:  #999999;
clear: both;
}
.wrap {
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
}
.sub {
    padding: 12px;
    width: 32%;
    height: 150px;
    background: #999999;
    color: white;
    border-right: solid white 1px;  
}

.sub:last-child {
    border: 0px;
}


#nav {
  list-style: none;
  font-weight: bold;
  width: 10%;
  text-align: center;
  background-color: #bfbfbf;
  padding-right: 20px;
  height: calc(100vh - 174px);
  float: left;

}
#nav ul {
  list-style-type: none;
    margin: 0px;
  padding: 0;
  overflow: auto;
  background-color: #bfbfbf;
}
#nav li {
  margin: 0px;
}
#nav li a {
  padding: 10px;
  display: block;
  text-decoration: none;
  font-weight: bold;
  color: pink;
  background-color: #bfbfbf;
}
#nav li a:hover {
  color:  white;
  text-shadow: 2px 2px 4px white;
}
#content {
    width: 500px;
    height: 100%;
  float: right;
  background-color: black;

}
<body>
<div id="pagewrap">
        <div id="nav">
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">Works</a></li>
                <li><a href="#">About</a></li>
            </ul>


        </div>
    <div id="content"></div>




    </div>



<!--
<footer id="footer">
</footer>
-->
<hr>
<div id="footer">
    <div class="wrap">
        <div class="sub">Lorem Ipsum</div>
        <div class="sub">Lorem Ipsum </div>
        <div class="sub">Lorem Ipsum </div>
    </div>
</div>

</body>

#content add

#content {
    width: 82%;
    background: red;
    float: left;
    height: 100%;
}

和#nav add

#nav { float;left;}

这是完整的标记

html {
	height: 100%;
}

body{
	height: 100%;
	
	margin: 0;
	font-family: courier;
	font-size: 19px;
}
* {
margin: 0;
}
#pagewrap {
min-height: 100%;
margin-bottom: -174px;
}
#pagewrap:after {
content: "";
display: block;
}
#footer, #pagewrap:after {
height: 174px;
}

.sub:last-child {
    border: 0px;
}
#footer {
background-color:  #00e600;    clear: left;
}
.wrap {
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
}
.sub {
    padding: 12px;
    width: 32%;
    height: 150px;
    background: #00e600;
    color: white;
    border-right: solid white 1px;  
}
.sub:last-child {
	border: 0px;
}

#nav {
  height: calc(100vh - 174px);
  list-style: none;
  font-weight: bold;
  width: 10%;
  text-align: center;
  background-color: brown;
  float:left;
  padding-right: 20px;
}
#nav ul {
  list-style-type: none;
  height: 100%;
  margin: 0px;
  padding: 0;
  overflow: auto;
  background-color: brown;
}
#nav li {
  margin: 0px;
}
#nav li a {
  padding: 10px;
  display: block;
  text-decoration: none;
  font-weight: bold;
  color: pink;
  background-color: brown;
}
#nav li a:hover {
  color:  white;
  text-shadow: 2px 2px 4px white;
}
#content {
        width: 82%;
    background: red;
    float: left;
    height: 100%;
}
<div id="pagewrap">
        <div id="nav">
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">Works</a></li>
                <li><a href="#">About</a></li>
            </ul>

        </div>
    <div id="content">
      
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>


    </div>

<!--
<footer id="footer">
</footer>
-->
<hr>
<div id="footer">
    <div class="wrap">
        <div class="sub">Lorem Ipsum</div>
        <div class="sub">Lorem Ipsum </div>
        <div class="sub">Lorem Ipsum </div>
    </div>
</div>

相关内容

  • 没有找到相关文章

最新更新