为什么div无法获取内容?

时间:2020-08-23 04:56:14

标签: html css devtools

带有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>

Here the DevTool...

如果我直接在DevTool中编辑div内容,则可以正常工作,并且看不到任何继承的样式更改。简而言之,我不明白这里发生了什么。

我非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

我明白了。我有一个愚蠢的错误。我正在学习,它显示了。

我正在用content.textContent = '';覆盖脚本

好几天以来,我一直在为此苦苦挣扎...实在令人沮丧...

谢谢大家的帮助和耐心。