Click here to Skip to main content
15,884,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My program as a Header, Article ,Nav, Aside, Footer. We I run my program, everything show up accept the The Color to the Header section. The footer and the Header have are set with

Header, footer {
background: green;
height: 20vh;
If you run the program, you will see that the color will not show in the Header. I can not figure out what is getting helping.

What I have tried:

HTML
<body>
    <header>Header</header>
    <div id="main">
        <article>Article</article>
        <nav>Nav</nav>
        <aside>Aside</aside>
    </div>
    <footer>Footer</footer>
</body>
CSS
* {
    box-sizing: border-box; 
}
body {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    margin: 0;
}
#main {
    display: flex;
    flex: 1;
}
#main > article {
    background: blue;
    flex: 1;
    order: 1;
}
#main > nav, 
#main > aside {
    flex: 0 0 20vw;
}
#main > nav {
    background: #D7E8D4;
    order: 3;
}
#main > aside {
    background: beige;
    order: 2;
}
Header, footer {
    background: green;
    height: 20vh;
}
Header, Footer, Article, Nav, aside {
    padding: 1em;
}
Posted
Updated 15-Sep-21 22:40pm
v3
Comments
Richard Deeming 16-Sep-21 4:42am    
Your code works fine for me, although you should correct the casing of the element selectors - header instead of Header, etc.

Demo[^]

Maybe your markup doesn't match? I had to guess at the parts which were lost when you posted your question.

1 solution

background: green
background-color: green;
 
Share this answer
 
Comments
Richard Deeming 16-Sep-21 4:36am    
Irrelevant - the background property is a shortcut for setting multiple background-related properties, including the colour. It's literally the first example in the documentation!

background - CSS: Cascading Style Sheets | MDN[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900