Design a logo to serve as the main button on the navigation bar of the

I've been experimenting with adding a logo instead of the 'Home' text in my navigation bar, but I'm not sure where to implement it. Should I add it within #nav or separately? Also, I want the nav bar to stay fixed without overlapping on other sections or disappearing on smaller screens. It might be too much to ask in one question.

Here's my HTML:

        <!-- Header -->
            <div id="header">

                <!-- Logo -->
                    <h1 hidden><a href="index.html" id="logo">Helios <em>Solutions</em></a></h1>


                    <nav id="nav">
                        <ul>
                            <li class="current" id="titlehome"><a href="index.html">Helios Solutions</a></li>
                            <li>
                                <a href="left-sidebar.html">Ons zorgaanbod</a>
                                <ul>
                                    <li><a href="#">Dienst 1</a></li>
                                    <li><a href="#">Dienst 2</a></li>
                                    <li><a href="#">Dienst 3</a></li>
                                    <li><a href="#">Cliënten aan het woord</a></li>
                                </ul>
                            </li>
                            <li>
                                <a href="left-sidebar.html">Over Helios Solutions</a>
                                <ul>
                                    <li><a href="#">Onze missie</a></li>
                                    <li><a href="#">Onze werkwijze</a></li>
                                    <li><a href="#">Ons team</a></li>
                                    <li><a href="#">Vacatures</a></li>
                                </ul>
                            </li>
                            <li>
                                <a href="left-sidebar.html">Voor cliënten</a>
                                <ul>
                                    <li><a href="#">Uw privacy</a></li>
                                    <li><a href="#">Uw klachten</a></li>
                                    <li><a href="#">Onze cliëntenraad</a></li>
                                </ul>
                            </li>
                            <li><a href="#contact" class="smoothScroll">Contact</a></li>
                            <li><a href="tel:+31505731019">050 573 10 19</a></li>
                        </ul>
                    </nav>
        </div>
    </div>

My CSS:

/* Header */

#header {
    padding: 0 0 0 0;
    background-color: #1176C0;
    background-image: url("images/bg02.png"), url("images/bg02.png"), url("images/bg01.png");
    background-position: top left,                  top left,                   top left;
    background-size:     0% 0,                      0% 0,                       auto;
    background-repeat: no-repeat,                   no-repeat,                  repeat;
}

    #header h1 {
        padding: 0 0 0 0;
        margin: 0;
    }

        #header h1 a {
            font-size: 1.5em;
            letter-spacing: -0.025em;
            border: 0;
        }

/* Nav */

    #nav {
    cursor: default;
    background-color: #1176C0;
    background-image: -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
    background-image: -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
    background-image: -ms-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
    background-image: linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
    padding: 0;
}

    #nav:after {
        content: '';
        display: block;
        width: 100%;
        height: 0.6em;
        background-color: #fff;
    }

    #nav > ul {
        margin: 0;
        font-weight: bold;
    }

        #nav > ul > li {
            position: relative;
            display: inline-block;
            margin-left: 1em;
        }

            #nav > ul > li a {
                color: #fff;
                text-decoration: none;
                border: 0;
                display: block;
                padding: 1.5em 0.5em 1.35em 0.5em;
            }

            #nav > ul > li:first-child {
                margin-left: 0;
            }

            #nav > ul > li:hover a {
                color: #F09200;
                font-weight: 600;
            }

            #nav > ul > li.current {
            }


                #nav > ul > li.current:before {
                    -moz-transform: rotateZ(45deg);
                    -webkit-transform: rotateZ(45deg);
                    -ms-transform: rotateZ(45deg);
                    transform: rotateZ(45deg);
                    width: 0.6em;
                    height: 0.6em;
                    content: '';
                    display: block;
                    position: absolute;
                    bottom: -0.4em;
                    left: 50%;
                    margin-left: -0.375em;
                    background-color: #fff;
                }

                #nav > ul > li.current a {
                    color: #fff;
                }

            #nav > ul > li.active a {
                color: #fff;
            }

            #nav > ul > li.active.current:before {
                opacity: 0;
            }

            #nav > ul > li > ul {
                display: none;
            }

My JS:

(function($) {

skel.breakpoints({
    wide: '(max-width: 1680px)',
    normal: '(max-width: 1280px)',
    narrow: '(max-width: 980px)',
    narrower: '(max-width: 840px)',
    mobile: '(max-width: 736px)',
    mobilep: '(max-width: 480px)'
});

$(function() {

    var $window = $(window),
        $body = $('body');

    // Disable animations/transitions until the page has loaded.
        $body.addClass('is-loading');

        $window.on('load', function() {
            $body.removeClass('is-loading');
        });

    // Fix: Placeholder polyfill.
        $('form').placeholder();

    // Prioritize "important" elements on narrower.
        skel.on('+narrower -narrower', function() {
            $.prioritize(
                '.important\\28 narrower\\29',
                skel.breakpoint('narrower').active
            );
        });

    // Dropdowns.
        $('#nav > ul').dropotron({
            offsetY: -15,
            hoverDelay: 0,
            alignment: 'center'
        });

    // Off-Canvas Navigation.

        // Title Bar.
            $(
                '<div id="titleBar">' +
                    '<a href="#navPanel" class="toggle"></a>' +
                    '<span class="title">' + $('#logo').html() + '</span>' +
                '</div>'
            )
                .appendTo($body);

        // Navigation Panel.
            $(
                '<div id="navPanel">' +
                    '<nav>' +
                        $('#nav').navList() +
                    '</nav>' +
                '</div>'
            )
                .appendTo($body)
                .panel({
                    delay: 500,
                    hideOnClick: true,
                    hideOnSwipe: true,
                    resetScroll: true,
                    resetForms: true,
                    side: 'left',
                    target: $body,
                    visibleClass: 'navPanel-visible'
                });

        // Fix: Remove navPanel transitions on WP<10 (poor/buggy performance).
            if (skel.vars.os == 'wp' && skel.vars.osVersion < 10)
                $('#titleBar, #navPanel, #page-wrapper')
                    .css('transition', 'none');

});

})(jQuery);

Answer №1

Add the line below either right after your navigation starting tag or just before the navigation ending tag, depending on whether you want the logo to appear on the left or right side of your navbar.

<a class="navbar-brand" href="path-to-root"><img src="path-to-logo"></a>

By following these steps, you should see your logo displayed on your navbar. I hope this explanation proves helpful.

(Note: "navbar-brand" is a Bootstrap class, but if you're not using Bootstrap, feel free to use this class to customize the styling of the logo in your own CSS).

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

Is there a way to convert an array into a single comma-separated value using parameters?

Is there a way to parameterize an array as a single name-value pair that is comma separated? I have tried using jQuery $.param, but it creates a parameter for each value in the array instead of just one. Unfortunately, it seems that there is no option or s ...

When working with a barcode font in Chrome, using style.fontFamily may not be effective, but utilizing className can achieve the desired result

Take a look at this HTML snippet: <style> .barcode { font-family: 'BC C39 3 to 1 Medium'; } </style> <div><span id='spn'>1234567</span></div> This code will apply a barcode font style: <script> ...

Implement admin-on-rest framework within my current project

Currently, I am in the process of building an admin-tool website using Material UI. To handle asynchronous calls, I have integrated Redux Saga into my project for calling services. The Admin on Rest framework offers some beneficial components like the Data ...

Mastering Inter-Composable Communication in Vue 3: A Guide

Composables in Vue documentation demonstrate how small composition functions can be used for organizing code by composing the app. Discover More About Extracting Composables for Code Organization "Extracted composables act as component-scoped servi ...

Choose only one option from the dropdown menu at a time within the specified div

I attempted to utilize the "setSelected" option on my multiselect feature, but I noticed that it does not function with div elements (at least I could not make it work myself). I am endeavoring to create two synchronized multiselects using this example: b ...

In JavaScript, there is a missing piece of logic when iterating through an array to find

I am working on a solution to populate empty values when data is not available for specific months. You can view my progress on Plunker here: http://plnkr.co/edit/f0IklkUfX8tkRZrn2enx?p=preview $scope.year = [ {"month":"mar", "val":"23"}, {"month":"feb", ...

What is a PHP self-generating variable?

Is it possible to use a form variable as its own URL? It may be difficult to explain, but here's an example: matchmaking.php: $search_summoner = $_POST['search_summoner']; echo '<form method="post" action="matchmaking.php?searc ...

Issue encountered when importing async function: Invalid hook call. Hooks are designed to be called only within the body of a function component

All I desire is the ability to access logic from my geolocationApi file in my react-native components without using a hook. Instead, I prefer normal asynchronous functions. The geolocationApi file employs a custom hook for handling mobx state updates, whic ...

Tips on incorporating personalized javascript functions into Durandal

I am currently working on my first project using the Durandal framework to create a basic website. I have encountered an issue while trying to incorporate a simple JavaScript function. My goal is to execute the function after the DOM has loaded, but I am u ...

Avoiding drag events in hammer.js until the previous event is finished

I've been working on a basic photo gallery that switches images during a drag event. However, I'm encountering an issue with the iOS7 browser where the drag event gets triggered multiple times when dragging left or right. I attempted to use a glo ...

Updating HTML label values using jQuery in a loop based on their index position

I am having an issue with my ajax call where I want to loop through each label in a class and set their value to the response returned from the server. However, the current code sets all labels to the same value instead of setting individual values based o ...

Saving the JavaScript console to a MySQL database: A step-by-step guide

I have purchased a JavaScript code online for running a spinwheel game. Now, I am looking to save the results from the spinwheel into a MySQL database. The JavaScript code already provides a result function, but I'm unsure how to save the result data ...

Can data be transferred from node.js express to front-end HTML without requiring a page refresh?

Currently, I have developed a webpage that showcases all meetings with collapsible accordions. Initially, all the meetings are collapsed. However, when the user clicks on the meeting button (labeled as 'Audio' in the screenshot), a request contai ...

Angular - Dividing Functionality into Multiple Modules

I am currently working with two separate modules that have completely different designs. To integrate these modules, I decided to create a new module called "accounts". However, when I include the line import { AppComponent as Account_AppComponent} from &a ...

What could be causing my code to generate an error?

I'm encountering an error in module.js:339 where it throws an 'err' and I'm struggling to identify the exact cause or line of code that needs fixing. Any guidance on where to look would be greatly appreciated, as I seem to be searching ...

Is there a way to modify a document without altering its original location?

I attempted to load an entire page using ajax, with the doctype and html tags removed. However, when I tried setting it with the following code: document.documentElement.innerHTML=xmlhttp.responseText; Google Chrome returned an error message: An invalid ...

Narrow down an array of objects by matching a specific property and value to a separate array of objects

I am facing a challenge with two sets of arrays - one for the headers (columns) of a table and the other for the rows. const headers = [ { text: 'Dessert (100g serving)', align: 'left', sortable: false, value: 'n ...

Tips for making a sidebar sticky when scrolling

In order to keep the right-side bar fixed, I have implemented this javaScript function: <script type="text/javascript> $(document).ready(function () { var top = $('#rightsidebar-wrapper').offset().top - parseFloat($('#rightsideb ...

The PHP-based registration process is malfunctioning

Trying to simply register, but I'm encountering an issue where the file is named Login.html/.php instead of just Login.html. Below is my HTML form in Login.html: <!DOCTYPE html> <html> <head> <title>Register/ Login</title&g ...

JavaScript file isn't being called by index.html

I am working on establishing a basic client/server connection using node.js modules along with a straightforward HTML page. The content of the HTML page is as follows: <script type="text/javascript" src="index.js"></script> The index.js fi ...