Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html div的背景色上载后不显示_Html_Css_Google Chrome - Fatal编程技术网

Html div的背景色上载后不显示

Html div的背景色上载后不显示,html,css,google-chrome,Html,Css,Google Chrome,我对代码做了一些修改,为某个文本块添加了一个新的div。在Chrome中查看HTML文件时,它显示得非常完美。但是,当我把它上传到我的网络托管服务时,我发现它显示时没有该div的背景色(而且只有该div)。不过,在我的手机上使用Chrome似乎显示正确。目前,我已经将网站本身和HTML文件并排打开,无法理解这是如何发生的 div不工作的CSS: #indexbar { background-color: rgba(176,224,230, 80%); border-radius:

我对代码做了一些修改,为某个文本块添加了一个新的div。在Chrome中查看HTML文件时,它显示得非常完美。但是,当我把它上传到我的网络托管服务时,我发现它显示时没有该div的背景色(而且只有该div)。不过,在我的手机上使用Chrome似乎显示正确。目前,我已经将网站本身和HTML文件并排打开,无法理解这是如何发生的

div不工作的CSS:

#indexbar {
    background-color: rgba(176,224,230, 80%);
    border-radius: 25px;
    position: fixed;
    bottom: 0;
    width: 90%;
    margin: 0 5% 0 5%;
}
用于div工作的CSS:

#main {
    padding: 0em 1em 0em 1em;
    background-color: rgba(176,224,230, 80%);
    border-radius: 25px;
    margin: 0 5em 0 5em;
}
编辑:为损坏的代码添加HTML

<div id="indexbar">
<h4><a href="portfolio.html">PORTFOLIO</a> | <a href="resume.html">RESUME</a> | <a href="about.html">ABOUT</a></h4>
</div>

|  | 

试试背景色:rgba(176224230,80%)!重要;有时,当其他样式覆盖背景色时,可能会发生这种情况。

只需尝试
背景色:rgba(176224230,80%)!重要
;有时,当其他样式覆盖背景色时,可能会发生这种情况。

您只需向
div
提供
height
或添加一些文本内容,就可以了。默认情况下,div元素采用
0px
高度。 检查下面更新的代码段

#indexbar{
背景色:rgba(176224230,80%);
边界半径:25px;
位置:固定;
底部:0;
宽度:90%;
利润率:05%05%;
身高:10%;
}

|  | 

您只需向
div
提供
height
,或添加一些文本内容,就可以了。默认情况下,div元素采用
0px
高度。 检查下面更新的代码段

#indexbar{
背景色:rgba(176224230,80%);
边界半径:25px;
位置:固定;
底部:0;
宽度:90%;
利润率:05%05%;
身高:10%;
}

|  | 

您确定CSS已正确链接到HTML吗??
否则,尝试将80%替换为.8

是否确定CSS已正确链接到HTML??
否则,尝试用.8替换80%

它在这里工作!将位置更改为“相对”,而不是“固定”

#indexbar {
    background-color: rgba(176,224,230, 80%);
    border-radius: 25px;
    position: relative;
    bottom: 0;
    width: 90%;
    margin: 0 5% 0 5%;
}


请清除文件缓存并重试

它在这里工作!将位置更改为“相对”,而不是“固定”

#indexbar {
    background-color: rgba(176,224,230, 80%);
    border-radius: 25px;
    position: relative;
    bottom: 0;
    width: 90%;
    margin: 0 5% 0 5%;
}


请清除文件缓存并重试

我刚试过,但似乎没用。谢谢你的邀请!不过重要的提示是,我以后会记住这一点。我刚试过,但似乎没用。谢谢你的邀请!重要提示,我以后会记住这一点。div中确实有文本,但我尝试在CSS中添加高度,但上传后仍然无法正确显示。文本在那里,但是背景没有显示。我把它添加到了文章的正文中,但我也会把它放在这里给你
|
@KatieB检查更新的答案。它在给定的代码段中运行良好,div中确实有文本,但我尝试在CSS中添加高度,但上传后仍然无法正确显示。文本在那里,但是背景没有显示。我把它添加到了文章的正文中,但我也会把它放在这里给你
|
@KatieB检查更新的答案。它在给定的时间内工作正常,清除缓存修复了它,谢谢!我不敢相信我之前没有想到。清除缓存修复了它,谢谢!我不敢相信我之前没有想到这一点。