What is the best way to make my navbar reach the edges of the screen?

Currently working on a regular navbar, but aiming to have the logo and links span the entire container instead of starting in the middle. I'm seeking an easy solution that won't push out my links when applied.

https://i.sstatic.net/nTFJ6.png

*{
    box-sizing: border-box;
    margin: 0px;
    padding: 0px;
}

body{
    background: pink;
    
}

nav{
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 8vh;
    background-color: yellow;
}

.logo{
color: whitesmoke;
text-transform:uppercase ;
letter-spacing: 5px;
font-size: 20px;
}

.nav-links{
    display: flex;
    justify-content: space-around;
    width: 25%;
   
}


li{
    list-style-type: none;
}

.nav-links a{
    color: black;
    text-decoration: none;
    letter-spacing: 3px;
    font-weight: bold;
    
}

Answer №1

nav {
  display: flex; 
  background: tomato;
  padding: 1rem
}

.logo {
  margin-right: auto;
}
<nav>
    <a href="#" class="logo">I am the logo</a>
    <div>
      <a href="#">link 1</a>
      <a href="#">link 2</a>
      <a href="#">link 3</a>
      <a href="#">link 4</a>
    </div>
  </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

Create a dynamic menu dropdown with absolute positioning using React

I recently made the transition to React and now I am in the process of converting my old vanillaJS website into ReactJS. One issue I am facing is with a button that is supposed to trigger the opening of a dropdown menu. <button type="button&qu ...

Finding out which side of a cube has been clicked---Let's identify the side

Currently, I am in the process of developing a navigation menu and I am looking for a way to detect which side the user has clicked. Is it possible to achieve this using raycasting or is there an alternative method that would work better? If you require i ...

Establishing the value of "document.cookie"

Encountering issues while trying to set a cookie using different methods: Method 1: document.cookie = name + "=" + value + "; expires=" + date.toUTCString() + "; path=/"; This method only sets the value up to "name=value" wh ...

The object of type 'NoneType' does not have the 'next_element' attribute

Here we have an HTML snippet of a website with a single itemprop="brand": <dd itemprop="brand" class="attributeValue-2574930263"> <a class="link-3970392289 link__default-1151936189 attributeLink-2414863004&qu ...

Having trouble with the PHP code for sending an email using a basic form

This is an example from my HTML page. <form method="POST" action="sm.php"> <p>Login</p><br /> Username: <input type="text" size="10" maxlength="50" name="un"> <br /> Password: <input type="text" size="10 ...

Update the JavaScript to modify the styling based on the specific value of the

Is there a way to apply specific style properties to images only if they already have another property? I've managed to achieve this with the following code snippet: if ($('#content p img').css('float') == 'right') $ ...

unexpected behavior in vue-router transition

Currently, I am in the process of working on my personal website. For the frontend, I have been using Vue.js along with vue-router. Everything was functioning smoothly until today, as evidenced here: (you will need to scroll down or use the arrow key down ...

Error: JSON parsing error encountered for token < at position 0 within the context of Google Sheets Apps Script Tutorial

I'm currently working through a Google Sheets Apps Scripts editor tutorial and I've reached module 4. Unfortunately, I've encountered an issue with the code I copied directly from the module. The error message I'm seeing is: SyntaxError ...

Exploring the best practices for organizing logic within Node.js Express routes

I'm currently utilizing the https://github.com/diegohaz/rest/ boilerplate, but I am unsure about the best practice for implementing logic such as QR code generation and additional validation. My initial thought was to include validation and password ...

Removing Redux State in ReactDeleting data from Redux in a

After displaying a list of data on a table, I have implemented a View component where specific data from the list is passed. However, I am facing an issue when attempting to delete something in the View modal dialog as the redux data delete reducer does no ...

What is the process for duplicating a set of elements within an svg file and displaying the duplicate at a specific location?

SVG <svg width="200" height="200"> <g id="group"> <rect x="10" y="10" width="50" height="20" fill="teal"></rect> <circle cx=" ...

Adjust the positioning of axisLeft labels to the left side

I have incorporated a @nivo/bar chart in my project as shown below: <ResponsiveBar height="400" data={barData} keys={["value"]} indexBy="label" layout="horizontal" axisLeft={{ width ...

Utilizing a Bootstrap column design with two columns in place - one column set at a fixed width while the second column stretches across the remaining

Need help with adjusting two columns on a webpage? The right column is fixed at 300px width, while the left column should take up the remaining space. Using flex works well, but when adding a responsive ad to the left column, it extends beyond the availabl ...

What is the best way to compare dates in PostgreSQL timestamp with time zone?

In my PostgreSQL database, there is a field labeled as "timestamp with time zone compare" Currently, I am trying to implement a data range comparison using JavaScript var start = Date.UTC(2012,02,30);//1333065600000 var end = Date.UTC(2013,02,30); //136 ...

Troubleshooting problem with div width in Outlook causing table cell padding issue for curved corners on another div

This question has significantly evolved following additional testing I am using a table layout similar to this: <table> <tr> <td></td> <td style="padding:10px 3%;"> <div border="2px solid #000000;"> ...

Personal Information Management

After making a request for stormpath user custom data, I used the following code: res.render('home', { title: 'home', user: req.user.customData, }); Instead of receiving a JSON object of custom data as expected, a URL ('') ...

Adding a fresh dependency to the current package.json file

Introduction: I am relatively new to JavaScript and have encountered a basic issue regarding adding dependencies to an existing JavaScript project. Despite double-checking the installation instructions, I seem to have encountered some errors in my terminal ...

Issue with node.js server functionality on Azure Cloud Services virtual machine

I am currently exploring node.js and experimenting with creating a basic node js server that functions properly on my local machine. Here is an example of the "Hello World" code: var http = require('http'); http.createServer(function (req, res) ...

A step-by-step guide on changing the class of a focused contenteditable element with a button click using jQuery

I need assistance changing the class of an element within a contenteditable div. Here is my current code: <button>swap class</button> <div contenteditable="true"> <h1 class="line-height-1">Your Headline Here</h1> </di ...

Trigger route handlers on both, successful authentication and failure, when using passport.js with a Node.js and Express.js REST API

Check out this simple login/token process using passport basic strategy for a Rest API: The Route: router.get('/token', authenticate.basic, controller.token); Authenticate Basic Strategy: authenticate.basic = passport.authenticate('basic ...