I am in the process of streamlining my CSS code by consolidating repetitive elements and removing unnecessary lines (I am currently enrolled in a mobile apps course that emphasizes creating web-based hybrid applications using HTML5, CSS, and JavaScript, hence the need for refactoring). Here is the original code snippet that I had:
body
{
width: 400px;
border: solid;
}
header, footer
{
background-color: #ADDFFF;
}
.buttons
{
width: 400px;
text-align: center;
background-color: #ADDFFF;
}
This code corresponds to an HTML structure like this:
<BODY>
<header>
</header>
<div class="buttons">
</div>
<footer>
</footer>
</BODY>
I attempted to add background-color: #ADDFF;
to the body CSS while eliminating other instances of background-color
. As expected, setting the background color at the body level caused the entire page to adopt the specified color. Is there a way to set the body background color only within the visible area of the page without excessive use of CSS declarations?
In short, I want the entire background of the page to share the same color, but the current approach results in coloring beyond the intended display area.