简体   繁体   English

在 Css 和 Html 中更改页脚背景的颜色

[英]Change color of the footer background in Css and Html

This is the footer part code of my project这是我项目的页脚部分代码

HTML Code: HTML代码:

<footer>
        <div class = "footer_container">
            <div class = "copyright">
                <h1>Urban Clothes | Copyright &copy; 2015-2020 </h1>
            </div>
        </div>
    </footer>

CSS Code: CSS 代码:

.footer_container{
    background-color: white;
    height: 400px;
    border: 2px solid lightblue;
}

Body Code:车身代码:

body{
    background-color: #24252A;
}

I am unable to change the background colour of my footer container.我无法更改页脚容器的背景颜色。 I changed the background colour of my body but the footer background colour is not changing.我改变了身体的背景颜色,但页脚背景颜色没有改变。

       .footer_container {
        background: red;
        height: 400px;
        border: 2px solid lightblue;
    }

try to do shift refresh for the page ur working it will work, try with these code尝试为您正在工作的页面进行轮班刷新,它会起作用,请尝试使用这些代码

Your code works for me.你的代码对我有用。 Maybe your browser has cached the style change your browser and try again or clear your web cache and then try again也许您的浏览器已缓存样式更改您的浏览器并重试或清除您的网络缓存然后重试

You have a background-color: white;你有一个background-color: white; in your .footer_container , if you want for footer to have the color of body just don't give it a background-color: white;在您的.footer_container ,如果您希望页脚具有正文的颜色,请不要给它background-color: white; or you can give it background-color: transparent;或者你可以给它background-color: transparent;

you can add !important, but it may affect other part of code if you have used same class name for other elements您可以添加 !important,但如果您对其他元素使用了相同的类名,它可能会影响代码的其他部分

.footer_container{
    background-color: white!important;
    height: 400px;
    border: 2px solid lightblue;
}

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

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