Streamlined Navigation Bar Design for Websites

Struggling with aligning all the navbar options in a single row. Here is an example:

https://jsfiddle.net/knyx2u8h/ ` Example Domain

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">

    #HomeNav {
    background: #132D93; /* Old browsers */
    background: -moz-linear-gradient(left,  #0000CD  32%, #4169E1 50%, #0000CD  68%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right top, color-stop(32%,#0000CD ), color-stop(50%,#4169E1), color-stop(68%,#0000CD )); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(left,  #0000CD  32%,#4169E1 50%,#0000CD  68%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(left,  #0000CD  32%,#4169E1 50%,#0000CD  68%); /* Opera 11.10+ */
    background: -ms-linear-gradient(left,  #0000CD  32%,#4169E1 50%,#0000CD  68%); /* IE10+ */
    background: linear-gradient(to right,  #0000CD  32%,#4169E1 50%,#0000CD  68%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0000CD', endColorstr='#0000CD',GradientType=1 ); /* IE6-9 */
    border-bottom: 5px solid #B9975B;
    margin-top:25px;


    }
    #HomeNav a {
    display: block;
    padding: 20px 10px;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-decoration:none;

    }
    #HomeNav a:hover, #global_nav a.active {
         background-color: #00008B;
         text-decoration: none;
    }

    #HomeNav ul {
         width:1200px;
        /*margin:0 auto;*/
        margin-left:-40px;
        /*position:relative;*/
         text-align:left;   


    }

    #HomeNav ul li{
         /*display:inline-block;    */
    display: inline-block;
    list-style-type: none;
    padding-right: 0px;


    }



    </style>    
</head>

<body>

     <nav id="HomeNav">
     <ul>
         <li><a href="Pages/About/about.html" > About</a></li>
         <li><a href="Pages/Who We Are/who we are.html" > Who We are</a></li>
         <li><a href="Pages/Latest publications/latest publications.html" >Latest Publications </a></li>
         <li><a href="Pages/Online Centre/online centre.html" >Online Centre </a></li>
         <li><a href="Pages/Our Partners/our partners.html" >Our Partners </a></li>
         <li><a href="Pages/English my way/english my way.html" >English My Way </a></li>
         <li><a href="Pages/Apprenticeship/apprenticeship.html" >Apprenticeship </a></li>
         <li><a href="Pages/it academy/it academy.html" >IT Academy </a></li>
         <li><a href="Pages/languagesense/languagesense.html" >Language Sense </a></li>

     </ul>
    </nav>

</body>
</html>

Answer №1

https://i.sstatic.net/fOFFH.pngmake a simple change to this CSS:

        #HomeNav a {
        display: block;
        padding: 20px 10px;
        color: #ffffff;
        text-transform: uppercase;
        font-size: 14px;
        letter-spacing: 0.5px;
        text-decoration: none;
}

you can try replacing it with the following adjustment:

#HomeNav a {
    display: block;
    padding: 20px 7px;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-decoration: none;
}

I hope this helps!

Answer №2

This is just an example to help you learn more - Demo: Navigation Bars

#HomeNav {
    background: #132D93; /* Old browsers */
    background: -moz-linear-gradient(left,  #0000CD  32%, #4169E1 50%, #0000CD  68%); // FF3.6+
    background: -webkit-gradient(linear, left top, right top, color-stop(32%,#0000CD ), color-stop(50%,#4169E1), color-stop(68%,#0000CD )); // Chrome, Safari4+
   ...
}
<nav id="HomeNav">
     <ul>
         <li><a href="Pages/About/about.html" > About</a></li>
         <li><a href="Pages/Who We Are/who we are.html" > Who We are</a></li>
         ...
     </ul>
    </nav>

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

Implementing an active state for the 'a' tag within Bootstrap 5 nav-tabs in an MVC application can be achieved by utilizing ActionLink

In my .NET MVC application, I am utilizing Bootstrap 5.1 to create navigation tabs with 'a' tags generated via ActionLink. <ul class="nav nav-tabs"> <li class="nav-item"> @Html.ActionLink("Enti ...

Using jQuery and HTML to create numerous links that direct to a solitary iframe

I created a basic overlay setup using css, html, and jQuery. Here's how it looks: <a class="activator" id="activator" style="" href="#">hello</a> <div class="overlay" id="overlay" style="display:none;"></div> <div style="d ...

Guide to leveraging the jotform API for form integration

Seeking a method to display forms created in JotForm using APIs. The goal is to make an API call, pass an ID, and retrieve the required information from JotForms to render the created form in JotForm. After researching, I haven't found a suitable sol ...

How can I make my JQuery datatable span the full width of the screen, regardless of the resolution?

In my Rails application, I am using JQuery Datatable with the following code: <%= content_tag :table, role: :my_datatable, id: 'my_datatable', style: 'height:500px; overflow-y: auto;&apo ...

Tips for executing a function on a specific class selector using the document.getElementsByClassName method

When I click on a specific class, I want to implement a fade-out function in JavaScript. However, I am struggling to make a particular class fade out successfully. I attempted to use the this keyword, but it seems like I might be using it incorrectly bec ...

Issues arise when the sub-menu does not function properly and overlaps with other elements of

I've been working with a client on their website and encountered an issue. On the mobile version of our menu, when I hover over a menu item that has several sub-menu items, those items display properly, but there is an element below them showing thro ...

Attempting to remove my user profile, but encountering technical difficulties with my code

I am facing an issue with my ajax code while trying to delete a user. The problem is that the ID of the selected user is not being picked up by the ajax script. The delete option for the user is located within a table that is generated through another aja ...

Iframe form submissions

I am interested in accomplishing the following task. My objective is to submit a form to my booking engine and show the results on either a new page or within a Div element. Ideally, when the user clicks the submit button, it would display an Iframe or re ...

Choosing the Right Project for Developing HTML/Javascript Applications in Eclipse

Whenever I attempt to build a webpage using eclipse, I am presented with two choices: -- A Javascript project -- A Static web project If I opt for the former, setting up run to open a web browser can be quite challenging. If I decide on the latter ...

Error in Angular 2 component when loading background images using relative URLs from an external CSS skin

In my angular2 component, I am utilizing a third-party JavaScript library. The skin CSS of the component attempts to load images using relative URL paths. Since I am following a component-based architecture, I prefer to have all component dependencies enca ...

What is the code in CodeIgniter to retrieve the string 'Sugar & Jaggery, Salt' using <a>?

Can someone please help me? I am a beginner in CodeIgniter and I am having trouble passing a URL with a string. The controller is not accepting the string as expected. How can I fix this issue? //Below is the HTML code for passing a string value index.ph ...

Align the ion content (or text or label) to the center vertically

I am striving to achieve a similar look as shown in the following images: https://i.sstatic.net/YFMay.png However, I am currently at this stage: https://i.sstatic.net/ZvpBV.png Please note that the first image showcases a bootstrap form, while the seco ...

Tips for embedding an object into an iframe source

I have successfully integrated a YouTube iframe into my HTML file. However, I would like the source URL to be dynamically generated based on data from the backend rather than manually inputting the URL as shown below. In the admin panel, there is an object ...

Press anywhere else on the screen to dismiss the bootstrap menu

I've been attempting to find a solution for closing the Bootstrap menu when clicking outside of it in a mobile window size, but I just can't seem to make it work. I did manage to get it working when clicking one of the 'a' links using t ...

Include brand logo to the Bootstrap navigation bar

Following the method provided in Bootstrap documentation, I included the following code: <div class="container"> <a class="navbar-brand" href="#"> <img src="/img/hangers.jpg" alt= ...

Using Bootstrap to horizontally align cards in a single row

When rendering the 4 items in a row using a for loop, I encounter an issue where the first line renders 4 items correctly but subsequent items are rendered on separate lines. code <div class="card-group"> {% for item in wt %} <di ...

Generate a .py file through an HTML button click and save it to your device

My current project involves developing HTML and JavaScript code for a chatbot. I need to implement a feature where, upon receiving a Python program from the chatbot, a download button should be displayed. When users click on this Download button, they shou ...

Looking for a JavaScript bookmarklet that can transform a CSS-styled table into an HTML <table>?

I am in need of a solution to convert a CSS-styled data display into a table-like format that can be used in a word processor. The issue is that the word processor does not recognize the structure created using CSS, resulting in a distorted layout. My goal ...

Tips for properly linking external JavaScript files to HTML documents

I decided to delve into the world of HTML and stumbled upon this interesting js fiddle link http://jsfiddle.net/xfkeM/ Now, I am attempting to construct a basic webpage, but unfortunately, the desired output seems to be eluding me. Below is a snippet of ...

Stick your navbar to the top with Bootstrap 4

I have a bootstrap 4.1 navbar set up and I'm trying to ensure that my div "#pin_to_top" always stays at the top of the navbar. This way, on wider screens, it will be displayed as: Logo - Menu - "#pin_to_top" (all in one row) And on smaller devices, ...