Having difficulty adjusting the background color of my footer navigation bar

My latest project involves creating a replica of the Google homepage using HTML and CSS. It's my first time delving into coding, and I've hit a roadblock while trying to set the background color for the lower navigation bar at the bottom of the screen. The upper navigation bar with the country name displayed was successfully styled, but the lower one - housing links like Advertising and Business - remains stubbornly white.

Here's the snippet from my HTML pertaining to the lower navigation bars

<footer class="bottom_nav">
    <div class="country_nav">
        <ul>
            <li>Canada</li>
        </ul>
    </div>
    
    <div class="bottom_nav_l">
        <ul>
            <li><a href="#advertising">Advertising</a></li>
            <li><a href="#business">Business</a></li>
            <li><a href="#howsearchworks">How Search Works</a></li>
        <ul>
    </div>

    <div class="bottom_nav_r">
        <ul>
            <li><a href="#settings">Settings</a></li>
            <li><a href="#terms">Terms</a></li>
            <li><a href="#privacy">Privacy</a></li>
        </ul>
    </div>
</footer>

This is the section from my CSS file

.country_nav {
    background-color: #f2f2f2;
    color: rgba(0,0,0,0.54);
    border-top: 1px solid #e4e4e4;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 25px;
}

.country_nav li {
    font-size: 14px;
    font-family: arial, sans-serif;
}

.bottom_nav_l li {
    float: left;
    margin: 10px;
    font-size: 14px; 
}

... (CSS styles for bottom_nav_r and other elements goes here)

I'm aiming for a consistent grey color scheme across all navigation bars. To get an idea of what I mean, feel free to check out a preview of the current state of my project here.

If you have any tips or guidance on how to achieve this, your help would be greatly appreciated!

Answer №1

If you want to create a bottom link without using ul and li, you can simply wrap your link in a div and apply CSS properties like display: flex and justify-content: space-between for spacing.

I also adjusted the styling of the a links to resemble Google's footer, adding padding and removing text decoration.

This is a demonstration showcasing an exact copy of Google's footer:

View Demo: https://jsfiddle.net/kx291hqm/

Please see snippet below to see how it's implemented:

.country_nav {
    background-color: #f2f2f2;
    color: rgba(0,0,0,0.54);
    border: 1px solid #e4e4e4;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 27px;
}


.bottom_nav_l li a {
    display: block;
    text-decoration: none;
}

.bottom_nav_r li a {
    display: block;
    text-decoration: none;
    color: rgba(0,0,0,0.54);
}

.bottom_nav_l li a:hover {
    text-decoration: underline;
}

.bottom_nav_r li a:hover {
    text-decoration: underline;
}

.bottom_nav_r {
    padding-right: 27px;
}

.bottom_nav {
    padding-top: 170px;
}

.bottom_link {
      display: flex;
    justify-content: space-between;
        line-height: 40px;
        background: #f2f2f2;
}
a {
  text-decoration: none;
    white-space: nowrap;
   color: #5f6368;
   padding-left: 27px;
}
<footer class="bottom_nav">
  <div class="country_nav">
    Canada
  </div>
  <div class="bottom_link">
    <div class="bottom_nav_l">
      <a href="#advertising">Advertising</a>
      <a href="#business">Business</a>
      <a href="#howsearchworks">How Search Works</a>
    </div>

    <div class="bottom_nav_r">
      <a href="#settings">Settings</a>
      <a href="#terms">Terms</a>
      <a href="#privacy">Privacy</a>
    </div>
  </div>
</footer>

Answer №2

To enhance the design, consider incorporating the following CSS code:

.bottom_nav{
background-color:blue;
}

Answer №3

I trust that this information will be beneficial to you.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .country_nav {
            background-color: #f2f2f2;
            color: rgba(0,0,0,0.54);
            border-top: 1px solid #ededed;
            padding-top: -1px;
            padding-bottom: 1px;
            padding-left: 25px;
        }

        .country_nav li {
            font-size: 14px;
            font-family: arial, sans-serif;
            margin-left: -10px;
        }

        section{
            background-color: #ebebeb;
        }

        .bottom_nav_l li {
            float: left;
            margin: 10px;
            font-size: 14px;

        }

        .bottom_nav_r li {
            float: right;
            margin: 10px;
            font-size: 14px;
            list-style-type: none;
        }

        .bottom_nav_l li a {
            display: block;
            margin-left: -10px;
            text-decoration: none;
            color: rgba(0,0,0,0.54);
        }

        ul {
            list-style-type: none;
        }

        .bottom_nav_r li a {
            display: block;
            text-decoration: none;
            color: rgba(0,0,0,0.54);
        }

        .bottom_nav_l li a:hover {
            text-decoration: underline;
        }

        .bottom_nav_r li a:hover {
            text-decoration: underline;
        }

        .bottom_nav_l {
            padding-left: 15px;
            background-color: #f2f2f2;
        }

        .bottom_nav_r {
            padding-right: 15px;
            background-color: #d7d7d7;
        }

        .bottom_nav {
            padding-top: 0px;
            position: relative;
            top: 460px;
        }
    </style>
</head>
<body>

<footer class="bottom_nav">
    <div class="country_nav">
        <ul>
            <li>Canada</li>
        </ul>
    </div>
    <section>
        <div class="bottom_nav_l">
            <ul>
                <li><a href="#advertising">Advertising</a></li>
                <li><a href="#business">Business</a></li>
                <li><a href="#howsearchworks">How Search Works</a></li>
                <ul>
        </div>

        <div class="bottom_nav_r">
            <ul>
                <li><a href="#settings">Settings</a></li>
                <li><a href="#terms">Terms</a></li>
                <li><a href="#privacy">Privacy</a></li>
            </ul>
        </div>
    </section>

</footer>
</body>
</html>

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

Discovering the quantity of image matches for a specific search term with VBA

I have been experimenting with HTML within Excel, attempting to estimate the prevalence of images at different resolutions. My goal is to create a dynamic system where users input a search term and the code cycles through predetermined image resolutions, r ...

Issues have been reported with the SVG filter URL functionality in Angular 4

Hey there! I'm currently working on drawing a line using SVG in Angular and incorporating some filters for glow effects. However, I've run into an issue where the filter URL is not functioning properly in the browser - nothing is being displayed ...

The CSS3 rotation transform will rotate by an angle of n degrees

I'm currently working on a cube-like element made up of 4 divs that I am rotating using CSS3 transforms (limited to -webkit for a Chrome extension). But there's an issue, if you visit http://jsfiddle.net/CxYTg/ and click through "one", "two", "t ...

Gain command over the underline style of text without relying on the border property

Ingredients: just a simple text input field. Question: Is there a way to customize the size, color, and position of the underline styling on an input tag? I noticed that the property text-decoration-color is supported in the moz browser engine, but I&apos ...

Is it possible to customize the Angular Kendo Grid to be non-scrollable and automatically adjust its height to fit the row contents?

I'm trying to create a Kendo Grid in Angular that is Non-Scrollable and adjusts its height to fit the row contents. However, my current implementation is not working as expected, as it still gives me a fixed height. <kendo-grid [data]="propertyVie ...

What is the best way to refresh a webpage in Vue.js following a specific event or a button click?

Is there a way to reload a webpage only once after clicking a button, without the need for auto-refreshing at set intervals? I've written my code in Vue.js. Can anyone offer guidance on how to accomplish this? Any assistance would be greatly apprecia ...

Occasionally, in Angular 8, there may be issues with data not displaying in the view (ngFor) when using array push

I have a straightforward data setup where I am using ngFor to display the data on the view. The process involves fetching all objects, pushing them into an array, and then populating them into the HTML. Everything works as expected in this setup. However ...

Unexpected white space appears at the bottom of the page when rotating the device in iOS Safari

One issue I encountered on my website involves a meta tag: <meta name="viewport" content="width=device-width, initial-scale=1.0"> This, combined with height:100%; on the html and body tags, causes problems when viewed on Safari ...

Achieving equal height columns in Bootstrap - text alignment within rows

Is there a method to make the heights of a text and image column equal? I am looking for a way to align the height of the text section with the image section. This adjustment would result in the picture being displayed cropped or shortened. .row-eq-hei ...

What is the method to reach the parameter of a sass mixin?

Currently, I am working on a sass mixin with the following structure: @mixin hello($arg1, $arg2, $arg3) { // content here } The challenge I am facing is to dynamically access the number of arguments within this mixin (in this case, it should be 3) in ord ...

Unusual behavior observed when calculating in Angular

Utilizing Angular.js, I dynamically calculate the height and add the value to the CSS style attribute within an ng-repeat loop. The issue arises with this particular line of code: <div style="height: {{60.0 / 100.0 * (100 - (100.0 / 0.27 * (item.wert ...

Optimizing Your HTML5 Code: Best Practices

Lately, I've come across some articles on HTML5 best practices and they all seem to emphasize the following guideline: "Prefer using id attribute over name attribute" But is this really the best approach? How can I effectively manage forms in PHP wi ...

Move the DIV from the left side with a nice slide

I'm working on using a basic div (leftContainer) and want to create an effect where it slides from the left to its full width when the page loads, without requiring a button click. Below is my code snippet: <div class="leftContainer "> <div ...

"Utilizing Bootstrap's Table Features within the Moodle Platform

Hey there! I'm currently in the process of updating a client's Moodle website. Our goal is to create responsive tables on the homepage, but I've encountered some challenges. Due to conflicts with other Moodle libraries, I wasn't able to ...

What makes the AngularJS ng-repeat search term filter fail to function properly?

I am attempting to create a dynamic table that filters and displays only rows containing the search term entered in the search box. Following a basic example from the w3schools tutorial, I am trying to get it to work properly: https://www.w3schools.com/ang ...

Is there a way to prevent the slide-out bar from automatically hiding when selecting an item from its list?

I am facing an issue with my dashboard that has a slideout sidebar. Whenever I press the toggle button, the sidebar slides out as expected. However, when I click on any tab within the sidebar, it hides again. I only want it to hide when toggled. My code is ...

What are the characteristics of a well-crafted HTML inline CSS form?

I am looking to create bubbles on a webpage to display content. I decided to create a CSS class called .bubble and added positioning values as inline styles. However, this resulted in long lines of code. My experience with various programming languages has ...

"Exciting Changes in Color According to the Active State of vue-route-link

I am trying to find a way to customize the CSS based on whether a link is exact or active. Essentially, when a user clicks on a menu item, I want the underline to change depending on whether the link is an active router-link. Although I was able to accompl ...

Easily switch between visible and hidden content by clicking on an image that functions as a swap or toggle

Hey there, I'm new to this and could really use your assistance, I'm looking for a simple show/hide toggle feature when clicking on an image, where it switches between a 'side arrow' and a 'down arrow' (similar to a dropdown) ...

`Problem with the layout of the form on the website`

Experiencing some challenges with the container design for a job sheet project. As a beginner, I have been learning on the fly and following online tutorials to create functional forms. However, this particular form is not rendering correctly when viewed o ...