Link in navigation located above on the page

I am trying to place this line at the top of the page above the navigation links (as shown in the screenshot).

In the screenshot it is the line above the Home link. I want the height of the ".navbar-links-" to be 100%. Here is the code for this element:

//Main code

body,
html {
    margin: 0;
    padding: 0;
    font-family: Arial;
    font-size: 1em;
    opacity: 1;
    overflow-x: hidden;
    min-width: 320px
}

a:active,
a:hover,
a:visited {
    background-color: inherit
}

.main-header .main-navbar {
    padding: 5vh 10vw;
    background-color: #222629
}


.main-header .main-navbar .navbar-links {
    list-style: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-family: RobotoRegular;
    font-size: 14pt;
    font-weight: 400;
    margin: 0
}

.main-header .main-navbar .navbar-links li {
    display: inline-block;
    margin-right: 30px;
    border-top: #00bff3 solid 5px;
    margin-top: -5px
}

.main-header .main-navbar .navbar-links li a {
    text-decoration: none;
    color: #9699a6;
    position: relative
}


.home-header .navbar-home-link>a {
    color: #00bff3!important
}

.home-header .navbar-home-link>a:before {
    content: '';
    pozition: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-top: #00bff3 solid 5px;
    margin-top: -5px
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8>
    <!-- <base href="/"> -->

    <title>Space hosting</title>

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">


</head>

<body>
    <header class="main-header home-header container-fluid ">
        <nav class="main-navbar row align-items-center">
            <ul class="navbar-links col align-self-center">
                <li class="navbar-home-link"><a href="javascript:void(0)"> Home</a></li>
                <li class="navbar-pages-link"><a href="javascript:void(0)"> Pages</a></li>
                <li class="navbar-hosting-link"><a href="javascript:void(0)"> Hosting</a></li>
                <li class="navbar-domains-link"><a href="javascript:void(0)"> Domains</a></li>
            </ul>
        </nav>
    </header>


</body>

</html>

I have removed some elements in this navbar, including 2 elements in "navbar-links" (specifically Blog and Contacts)

Thank you in advance.

Answer №1

.main-header .main-navbar {
    padding: 0 10vw;
    background-color: #222629
}


.main-header .main-navbar .navbar-links li {
    display: inline-block;
    margin-right: 30px;
    border-top: #00bff3 solid 5px;
    margin-top: -5px;
    padding-top: 5vh;
    padding-bottom: 5vh;
    position: relative;
}

.main-header .main-navbar .navbar-links li a {
    text-decoration: none;
    color: #9699a6;
    position: relative
}

.main-header .main-navbar .navbar-links li:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-top: #00bff3 solid 5px;
    margin-top: -5px
}

Instead of adding .home-header .navbar-home-link>a:before, add before element to .main-header .main-navbar .navbar-links li https://i.sstatic.net/ygm4S.jpg

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

Reveal each element individually upon clicking the button

I am trying to display 5 div elements one by one when clicking a button, but the current code is not working. I am open to alternative solutions for achieving this. Additionally, I want to change the display property from none to flex in my div element. ...

The background image is not adjusting properly to the browser when resized

I'm having trouble keeping my background image fitted to the browser when I resize the window. Can someone please assist me with this issue? Here are links to images that illustrate what's happening: View images. The first image shows how it shou ...

Is there a way to retrieve the modal's viewport height in Angular?

Is it possible to determine the viewport height of my ng bootstrap modal within my Angular application? Here is what I currently have: I have a modal with CSS styling as shown below: .modal-xxl { width: 95% !important; max-height: 90% !important; ...

Utilizing jQuery AJAX to efficiently handle branching based on the result received

I've successfully set up my first AJAX call with jQuery. The only thing left to do is to check the result from the PHP page for any database errors and display an error message if necessary. Here's the current Javascript code: <script type=" ...

Creating a Popup with JS, JQuery, CSS, and HTML

Seeking assistance in creating an HTML, CSS, and JS/jQuery popup. Looking to have a button that reveals a div tag when clicked, which can also be closed. Any quick responses with solutions would be greatly appreciated. Thank you in advance! ...

What is the process for adjusting the horizontal position of a flexbox using CSS?

Currently experimenting with flexbox to better understand its functionality. I have created the following layout: https://i.sstatic.net/rxvFD.png using the code provided below: .container-1 { display: flex; flex-direction: row; } .container-1 div ...

Issue with displaying Favicon on staging server

I need assistance with this issue. I am working to show a title and logo on a tab. It is functioning correctly on my local machine, but the logo is not appearing on the staging server. <title>Global</title> <link type="image/png" href ...

Performing a simulated click on a dynamically inserted element using pure JavaScript

I am faced with the challenge of programmatically navigating a ReactJS-based website in a looped workflow. The process involves clicking on Element1, dynamically altering the web page to add Element2, then clicking on Element2, and so on until eventually r ...

Make a div with absolute positioning overflow outside of a div with relative positioning that is scrollable

I am facing an issue with two columns positioned side by side. The right column contains a tooltip that overflows to the left on hover. Both columns are scrollable and relatively positioned to allow the tooltip to follow the scroll. However, the tooltip is ...

Php Error 404 occurs upon attempting to redirect from the main landing page

I have been encountering an issue while trying to add links to different pages of my website. Whenever I click on the link, it displays a "404 Page Not Found" error message. Objective: My main goal is to create links from my home page, index.php, to other ...

What is the best method to create a transparent first row and all columns using css?

Is there a way to implement this design using HTML and CSS? https://i.sstatic.net/RjD6l.jpg Keep in mind that the first row and columns in the first row should be transparent. ...

Expand Bootstrap navigation bar for extra large screens and collapse for smaller

On my website, I am using the navbar navbar-expand-xl class to hide my navigation menu. It works correctly for resolutions lower than 1200px, but the collapse button disappears at 1000px and then reappears. How can I modify this so that the collapse button ...

Enhancing audio control features using HTML and JavaScript

After utilizing various suggestions, I have successfully created a basic audio slider that starts playing sound (at zero volume) when clicked by the user. They can then adjust the volume as needed. My only challenge is that the volume adjustment only occu ...

"What is the best way to display mathematical equations written in HTML within a Flutter

My HTML Text <p>hello</p> <div class="mathjax-equation"> \(x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\) </div> I am interested in displaying this mathematical equation on a Flutter mob ...

Formatting Outlook HTML Signatures

I'm currently designing an HTML email signature for Outlook, but I'm having trouble with formatting and ensuring it looks consistent across different devices. When I preview the HTML in my browser, it appears exactly as I intended. However, I am ...

This method or property is not supported by the object - How to call an Applet in Internet Explorer 9

cmd > java -version Java Version : "1.7.0_11" (Updated) Java(TM) SE Runtime Environment (build 1.7.0_11-b21) Java HotSpot(TM) Client VM (build 23.6-b04, mixed mode, sharing) browsers = IE7,IE8,IE9 (The functionality works smoothly in Google Chrome and ...

Filtering a section of the HTML using Ajax and jQuery

Dealing with an Ajax call in jQuery that's delivering a lot of unexpected HTML content. I'm attempting to extract the specific part I need, but the console is showing an empty string. Can anyone provide guidance on resolving this issue? $.ajax({ ...

Why is my output getting mixed up with the header on the navigation bar page?

output capture image https://i.sstatic.net/BYJnk.jpg here is the code snippet //ui.r library(shiny) navbarPage(theme = "style.css",img(src="logo.jpeg", width="300px"), tabPanel("Dashboard"), tabPanel("Products"), tags$head( t ...

Executing a function with the initial click

Is there a way to run a function only on the first click, without having it run every time? I already have another function running on window.onload, so I can't use that. Both functions work fine independently, but not together. Right now, I'm ca ...

What are the disadvantages associated with the different methods of submitting data?

My goal is to create an Online testing platform. I have come across two different approaches to verify user-selected answers. Approach 1 <div class="qContainer" index="0"> Who holds the record for scoring 100 centuries in International cricke ...