简体   繁体   English

CSS背景颜色不适用于第一个div

[英]css background-color not working on first div

I have a 3 fixed position divs, the first one is not displaying the background-color and I am scratching my head here because I have tried everything, I don't see anything unusual with my code, not sure why this could be happening if someone could assist please. 我有一个3个固定位置的div,第一个不显示背景色,我在这里挠头,因为我已经尝试了一切,我的代码看不到任何异常,不确定为什么会发生这种情况有人可以帮忙。

Here is my HTML: 这是我的HTML:

<div class"header">

</div>
<div class="gssd">
    <iframe frameborder="0" scrolling="no" src="http://www.example.com"></iframe>
</div>
<div class="gosd">
    <p>testing 123</p>
</div>

Here is my CSS: 这是我的CSS:

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    font-family: Helvetica;
    background-color: #000;
    font-weight: bold;
    margin: 0;
    padding: 0;
}

.gssd {
    position: fixed;
    top: 100px; 
    bottom: 100px;
    left: 0;
    right: 0;  
}

.gssd > iframe {
    background: url(/tvScreensScript/img/acquire-wp.jpg);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;  
    overflow: auto;
    width: 100%;
    height: 100%;  
}

.gosd {
   position: fixed;
   bottom: 0;
   left: 0;
   right: 0;
   width: 100%;
   height: 100px;
   font-size: 4em;
   color: #141f65;
   background: url(/tvScreensScript/img/scroll-bg.png) no-repeat top right;
   font-family: Comic Sans MS;
   font-weight: bold;
}

You are missing the equals sign when setting the class on the div in your html. 在html的div上设置类时,您缺少等号。 class"header" should be class="header" class"header"应该是class="header"

Demo Fiddle 演示小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM