Nav background image will have a height that covers 100% of the page

I'm having trouble getting the navigation background image to match the height of my page, and I've tried various methods suggested on this platform with no success. As a beginner in HTML5 and CSS, please excuse me if this is a basic question. This is the CSS code I have:

body {
    background-color: #FF9933;
}
header {
    background-image: url(orangesquares.png);
}
h1 {
    background-color: #FFFFFF;
    opacity: 0.6;
    padding: 10px;
    width: 275px
}
h2 {
    color: #FF9933;
}
nav {
    background-image: url(orangesquares.png);
    float: left;
    width: 200px;
    margin-top: 0;
    Margin-bottom: 0;
    font-weight: bold;
}
nav ul {
    list-style-type: none;
    background-color: #FFFFFF;
    opacity: 0.6;
    padding: 10px;
}
#rightcolumn {
    margin-left: 205px;
    background-color: #ffffff;
    color: #000000;
    width: 80%;
}
.content {
    padding: 10px 20px 0 20px;
}
#footer {
    text-align: center;
    font-size: 11px;
}
a:link {
    color: #0033FF;
}
a:visited {
    color: #0033FF;
}
figure {
    width: 500px;
    border: 1px solid #FF9933;
    padding: 5px;
}
figcaption {
    text-align: center;
    font-size: 2em;
}

This is the HTML code for my index page:

<!DOCTYPE html>

<html lang="en">
    <head>
        <title>Sims 3 Open House</title>
        <meta charset="utf-8">
        <meta name="description" content="Sims 3 Open House provides information on houses included in the Sims 3 bin, such as what furniture is included and how many squares big the rooms are." />
        <meta name="keywords" content="Sims 3, the sims 3, the sims, sims, open house, house, houses, home, homes, lots and houses bin, bin, premade, premade houses, lot size, house size, furniture" />
        <link type="text/css" href="openhouse.css" rel="stylesheet" />
    </head>

    <body>

        <header>
            <h1>Sims 3 Open House</h1>
        </header>

        <nav>
            <ul>
                <li><a href="index.html">Home</a></li><br>
                <li><a href="index.html#onebedroom">One Bedroom Homes</a></li>
                <ul>
                    <li>Cabin Fever</li>
                    <li>Super Shack</li>
                </ul>
                <li><a href="index.html#twobedrooms">Two Bedroom Homes</a></li>
                <ul>
                    <li>Ginger</li>
                    <li>Oak Grove Bungalow</li>
                </ul>
                <li><a href="index.html#threebedrooms">Three Bedroom Homes</a></li>
                <ul>
                    <li>Cornucopia</li>
                    <li>Doubleday Lodge</li>
                </ul>
                <li>Contact Us</li>
        </nav>

        <article>
            <div id="rightcolumn">

                <div class="content"> 
                    <h2>Welcome</h2>
                    <p>Are you trying to choose a house from the Sims 3 bin but unsure where to start? Wondering about their interior design or room sizes? Interested in their furniture options? Look no further! I've categorized the bin houses by the number of bedrooms to make your search easier. Each house's page features detailed layout information, room dimensions, included furniture, lot size, and price. All screenshots were captured in <a     href="http://www.thesims3.com/assetDetail.html?assetId=7016943">Sunset Valley 2</a>. </p>

                    <a id="onebedroom"><h2>One Bedroom Homes</h2></a>


                    <figure>
                        <img src="cabinfever.jpg" width="500px" alt="The front facade of the home Cabin Fever." />
                        <figcaption>
                            Cabin Fever
                        </figcaption>
                        </figure> <figure>
                        <img src="supershack.jpg" width="500px" alt="The front facade of the home Super Shack." />
                        <figcaption>
                            Super Shack
                        </figcaption>
                    </figure>

                    <a id="twobedrooms"><h2>Two Bedroom Homes</h2></a>

                    <figure>
                        <img src="ginger.jpg" width="500px" alt="The front facade of the home Ginger." />
                        <figcaption>
                            Ginger
                        </figcaption>
                    </figure>
                    <figure>
                        <img src="ogb.jpg" width="500px" alt="The front facade of the home Oak Grove  Bungalow." />
                        <figcaption>
                            Oak Grove Bungalow
                        </figcaption>
                    </figure>

                    <a id="threebedrooms"><h2>Three Bedroom Homes</h2></a>

                    <figure>
                        <img src="cornucopia.jpg" width="500px" alt="The front facade of the home Cornucopia." />
                        <figcaption>
                            Cornucopia
                        </figcaption>
                    </figure>
                    <figure>
                        <img src="doubleday.jpg" width="500px" alt="The front facade of the home Doubleday Lodge." />
                        <figcaption>
                            Doubleday Lodge
                        </figcaption>
                    </figure>

                </div>

                <br> 

                <div id="footer">
                    <footer>
                        Home | One Bedroom Homes | Cabin Fever | Super Shack | Two Bedroom Homes | Ginger | Oak Grove Bungalow | Three Bedroom homes | Cornucopia | Doubleday Lodge | Contact Us
                        <br>
                        Copyright &copy; 2015 Natasha Schmidt
                    </footer>
                </div>

    </body>
</html>

Answer №1

What's the reasoning behind placing your background in the navigation section?

You could consider extending it to full height.

nav
{
background-image: url(orangesquares.png);
background-size: cover;
float: left;
height:100%
width: 200px;
margin-top: 0;
Margin-bottom: 0;
font-weight: bold;

}

Alternatively, a better approach would be:

html{
   padding:0; margin:0;background-image: url(orangesquares.png);
background-size: cover;
}

This way, you can remove the background from the navigation entirely.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing a box within a background image using HTML and CSS

In the midst of my college project, I've encountered a hurdle. There's an image I need to overlay with a box that has padding on all sides corresponding to the outline of the image. Despite my attempts, I haven't been successful in achieving ...

Find the initial element using the class name to retrieve the CSS properties

.class + p:first-child{ } The code above isn't functioning properly, unless it's an element instead of a class, like p:first-child. <div class="wrap"> <h3></h3> <div style="clear:both"></div> <p></p> & ...

Every single image within a specific domain

Exploring a way to create a gallery showcasing all the images within my domain's internet root folder. These images are scattered across various folders. What is the most efficient method to navigate through these folders and display the images? ...

Centering text on input placeholder

What is the best way to center a placeholder vertically in an input field? input[type='text']{ background-color: rgba(255,255,255,.4); border:3px solid rgba(0,0,0,.5); min-height: 45px; border-radius: 6px; color:#fff; } input[type=&apo ...

What is the method to programmatically trigger the highlight effect (similar to mouseover) in Javascript or JQuery?

In the process of creating an interface that features a list of large buttons, I am interested in implementing functionality to highlight a button based on the movement of the mouse. Essentially, I would like the button below the currently highlighted butt ...

Image caption dynamically updated to match thumbnail caption using jQuery upon click event

My goal is to dynamically load the data-caption of thumbnail images when clicked, and then update the main image's data-caption when the main image is changed with a thumb image. I am currently struggling to make the data-caption update along with the ...

Display the list items when the page first loads

I currently have this code snippet: <nav> <ul class="sel"> <li> <a href="#LINK1" data-title="A">A</a> </li> <li> <a href ...

Tips for avoiding cursor sticking in css rotate transform in firefox?

I have a unique challenge in this code where I want the user to grab the black square and rotate it around the inner circle. Check out the code snippet here. While attempting to rotate the square, you might notice that the cursor sometimes gets stuck in ...

Using `display:table-cell` does not function correctly when set to a 100% width

I'm having an issue with aligning text vertically inside a div: display:table-cell; vertical-align: middle; While the text aligns properly, the div (which has a width of 100%) is shrinking in width. What could be causing this problem and is there a ...

Harnessing the power of JSON within an HTML document to display dynamic data

Check out the JSON data through this link: The JSON file contains information about the weather. I need assistance with incorporating the data from the provided link into my HTML document as I am new to utilizing JSON for this purpose. <html> < ...

Is there a way to display an asterisk within a select2 dropdown to signify that a field is mandatory?

I'm facing an issue with the Select2 plugin in my form. While all fields are required and marked by an asterisk when empty, the Select2 dropdown ignores this validation attribute. Therefore, I am wondering: Is there a way to display an asterisk image ...

What is causing the navigation bar items to shift with the logo when attempting to position it to the left?

Whenever I attempt to shift .logo to the left, it also drags all the other navbar items (Home, Features, Pricing, Disabled) along with it. All I want is for .logo to move to the left without affecting the positioning of the other navbar items. I should me ...

"The server responded with a 405 error message indicating that the requested method

I have been working on a registration form project using HTML, JS, NodeJS, and SQLite. However, I am encountering an issue with the fetch function when trying to post the inputted information into the database. I keep receiving a POST 405 (Method Not Allo ...

What steps can be taken to modify the style of a single button belonging to a broader group of elements?

Is there a way to hide the save button within a Vue Modal without affecting other buttons with the same class? .btn.btn-primary { display: none; } Simply targeting .btn-primary in the CSS affects all elements with that class, and adding .modal woul ...

Is there a combination of 'auto' and 'none' values in any CSS properties?

Is it safe to assume that if a property is set to auto, it cannot have the value of none, and vice versa? Or if a property has none, can it not have auto as well? I understand that these values have distinct meanings, but I am curious if this concept has ...

"Bootstrap4 - Troubleshooting the Issue of Multiple Carousels Not Function

I attempted to incorporate 2 Bootstrap 4 carousels onto a single page, but encountered issues with the functionality. I utilized this code on my page, however, the last element in the carousel does not cycle correctly. There is a delay of 3 transactions be ...

An XPath expression to locate a descendant element relative to an ancestor element higher up in the hierarchy compared to

<oc-resume-upload> <div data-test="resume-upload-container" class="form-section"> <div class="flex flex-column"> <h2 class="form-section-header form-section-header--required&qu ...

Creating formatted code blocks within my HTML document

I'm currently working on achieving this layout in my HTML: https://i.stack.imgur.com/2LEQO.png Here is the JSFiddle link: https://jsfiddle.net/cr9vkc7f/4/ I attempted to add a border to the left of my code snippet as shown below: border-left: 1px ...

Can I leverage Bootstrap's 5 grid system exclusively?

Previous iterations of Bootstrap allowed for the creation of custom setups, specifically focusing on the grid system. Is it possible to craft a tailored Bootstrap 5 configuration that exclusively includes support for the grid system? ...

The Spotify List items generated from stored localStorage information are showing as empty

I'm currently developing an app for Spotify and I am facing some challenges while trying to create a views.List object using data stored in our database. Initially, I make a POST request to retrieve the required information and store it in local stora ...