【发布时间】:2020-12-12 01:27:52
【问题描述】:
带有 class="content" 的 div 没有显示其内容,我不明白为什么。
body {
width: 100%;
height: 100%;
margin: 0px;
font-family: 'Handlee';
color: #004e64;
}
.topBar {
display: inline-grid;
grid-template-columns: 33.33% 33.33% 33.33%;
width: 100%;
height: 90px;
position: fixed;
box-shadow: 0 6px 15px 0 rgba(0,0,0,0.07);
}
.content {
position: absolute;
top: 91px;
width: auto;
height: auto;
transition: 0.4s;
}
.burger {
padding: 5px;
margin: 14px;
float: left;
}
.burgerIcon {
padding: 3px;
margin: 10px;
cursor: pointer;
width: 37px;
height: 26px;
}
.bar1, .bar2, .bar3, .vertLine, .horiLine {
height: 5px;
background-color: #004e64;
margin: 2px;
border-radius: 2px;
}
.bar1, .bar2, .bar3 {
width: 35px;
float: left;
transition: 0.4s;
}
.bar2 {
width: 30px;
margin-left: 4px;
}
.change .bar1 {
-webkit-transform: rotate(-45deg) translate(-5px, 5px);
transform: rotate(-45deg) translate(-5px, 5px);
}
.change .bar2 {
opacity: 0;
}
.change .bar3 {
-webkit-transform: rotate(45deg) translate(-7px, -8px);
transform: rotate(45deg) translate(-7px, -8px);
}
.vertLine, .horiLine {
width: 20px;
}
.horiLine {
position: absolute;
margin-top: -7px;
}
.vertLine {
transform: rotate(90deg);
margin-top: 6px;
}
.changeToCross {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.title {
display: flex;
flex-direction: column;
justify-content: center;
color: #004e64;
}
h1, h2 {
margin: 0px;
text-align: center;
}
.newTaskButton {
display: inline-flex;
justify-content: center;
padding-top: 25px;
}
.newTaskIcon {
transition: 0.4s;
cursor: pointer;
display: flex;
align-items: center;
margin-bottom: 20px;
}
.newTaskPlus {
display: inline-block;
transition: 0.4s;
}
.newTaskText {
padding-left: 5px;
font-size: 30px;
}
.sideBar {
position: fixed;
top: 91px;
width: 0;
height: 100%;
z-index: 1;
padding-top: 30px;
overflow: auto;
box-shadow: 0 6px 15px 0 rgba(0,0,0,0.3);
transition: 0.4s;
}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Handlee&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<title>TODO App</title>
</head>
<body>
<header id="topBar" class="topBar">
<diV id="burger" class="burger">
<div id="burgerIcon" class="burgerIcon">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
</diV>
<div class="title">
<h1>TODO App</h1>
<h2 id="currentProject">Proyecto</h2>
</div>
<div id ="newTaskButton" class="newTaskButton">
<div id="newTaskIcon" class="newTaskIcon">
<div id="newTaskPlus" class="newTaskPlus">
<div class="vertLine"></div>
<div class="horiLine"></div>
</div>
<span id="newTaskText" class="newTaskText">Nueva Tarea</span>
</div>
</div>
</header>
<main>
<div id="sideBar" class="sideBar"></div>
<div id="content" class="content">
<h2>Collapsed Sidebar</h2>
<p>Click on the hamburger menu/bar icon to open the sidebar, and push this content to the right.</p>
</div>
</main>
<script src="main.js"></script>
</body>
</html>
如果我直接在 DevTool 中编辑 div 内容,它可以正常工作,并且我看不到样式有任何继承变化。简而言之,我不明白这里发生了什么。
我非常感谢任何形式的帮助。
【问题讨论】:
-
您包含的代码没有问题,所以问题出在其他问题上。请查看如何创建 minimal,reproducible example 以在您的问题中包含所有相关代码,以便我们了解可能导致问题的原因并提供帮助。
-
我要偷走所有这些漂亮的 CSS。
-
请同时包含您的 Javascript 代码