Ways to include additional hyperlinks in my navigation bar

I am seeking ways to enhance my CSS menu so that there is no lag when new links are added. I aim to include 8 additional links if possible. Is there a way to prevent this delay and ensure that the links align correctly?

nav {
  display: inline-block;
  width: 600px;
  float: right;
  text-align: right;
}

nav ul {
  list-style-type: none;
}

nav li {
  display: inline-block;
  margin-right: 15px;
}

nav a {
  font-size: 15px;
  color: #fff;
  text-decoration: none;
}

nav a:hover {
  color: #BEBEBE;
}

.header {
  background-color: #1A5694;
  width: 810px;
  height: 52px;
  border-radius: 5px 5px 0px 0px;
}

.headerconnexion {
  float: right;
  width: 100px;
  margin: 13px 13px 0px 0px;
}

.headerconnexion a {
  color: #B3D1FA;
  text-decoration: none;
}

.logo {
  width: 10%;
  margin: 13px 0px 0px 20px;
}
<div class="header">
  <a href="index.php">
    <img class="logo" src="http://image.noelshack.com/fichiers/2016/08/1456571967-facebook-logo-png-transparent-background.png" />
  </a>
  <nav>
    <ul>
      <li><a href="index.php">Link toast</a></li>
      <li><a href="index.php">Link toast</a></li>
      <li><a href="index.php">Link toast</a></li>
      <li><a href="index.php">Link toast</a></li>
      <li><a href="index.php">Link toast</a></li>
      <li><a href="index.php">Link toast</a></li>
      <li><a href="index.php">Link toast</a></li>
      <li><a href="index.php">Link toast</a></li>
    </ul>
  </nav>

</div>

Check out the example here

Answer №1

To fix the alignment of the navigation bar, simply delete the width

nav {
  display: inline-block;
  float: right;
  text-align: right;
}

JSFiddle Link

Answer №2

If you desire a responsive menu similar to Bootstrap, it is recommended to utilize percentages (%) and em units in your CSS.

For smartphones and smaller devices, incorporating media queries is essential for achieving an aesthetically pleasing menu design. Additionally, here are some suggested adjustments for your code:

nav {
    display: inline-block;
    float: right;
    text-align: right;
}
nav ul {
    padding: 0;
}

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

The Web Browser is organizing CSS elements in an alphabetized sequence

map.css({ 'zoom': zoom, 'left': map.width()/(2*zoom) - (point[0]/100)*map.width(), 'top': map.height()/(2*zoom) - (point[1]/100)*map.height() Upon observation, it appears that Chrome adjusts the map zoom first be ...

Transferring data between pages using HTML5 and jQuery

I'm currently developing Windows Phone 8 apps using HTML5 and jQuery. My project involves two HTML pages - the first page consists of input boxes and a button, while the second page contains controls to display the data entered on the first page. Upon ...

When I incorporate the h-100 class, my content expands beyond the container on mobile devices

Struggling with implementing bootstrap 4.0? I'm attempting to utilize h-100 to ensure that the background stretches to the bottom of the user's screen. I've experimented with clearfix, fluid-containers, and more in an effort to make it work ...

What is the best method to pass a JavaScript file array to a Node.js server?

Is it possible to transfer data from a Javascript file linked to an HTML page to a Node.js file on a post route without displaying it on the HTML page? If so, what is the best way to accomplish this? ...

How can I ensure that the image fits perfectly within the box using HTML and CSS

I'm having trouble displaying an image perfectly within my div. The image doesn't cover the entire box. Here is my code: .card-background{ background-image: url("../../../assets/imgs/back-blank.png"); border-radius: 10px; margin-top: 2%; ...

Utilize images inputted via an HTML DOM file uploader within p5.js

I'm facing a challenge with allowing users to upload their image file through a DOM file uploader (<input type="file"></input>). Once the image is uploaded, I'm unsure of how to transfer it to JavaScript and process it using p5.js. Ho ...

Attempting to monitor the frequency of calls to a JavaScript function

let totalEnteredCount = 0; function totalEntered(field){ if(field.value != '') { totalEnteredCount++; } alert(Counter); if(totalEnteredCount == 3) { var InitialVelocity = document.getElementById("IVUnit").value; var FinalVelocity = do ...

jQuery slider - display unlimited images

Currently, I am encountering issues with a Flickity carousel of images. When an image/slide is clicked, a modal window opens to display a zoomed-in version of the image. The problem arises when there are more or fewer than 3 images in the slider — my cod ...

jQuery: Automatically scroll to the end of the div based on the height of the content within

I have successfully developed a chat feature that is functioning perfectly. However, I am encountering an issue with making my div scroll to the bottom. The height of the div is calculated as calc(100% - 60px);. This particular div retrieves messages from ...

Discover the secret to applying a gradient shade to the "border" element when it reaches full capacity with Vue's innovative Custom CSS package

Utilizing the package https://www.npmjs.com/package/vue-css-donut-chart#usage-with-all-the-available-props to create a "border" effect around images based on progress has presented a challenge. Specifically, achieving a gradient color for the border when i ...

Can someone assist me in successfully incorporating a web font into a template?

After downloading a Wordpress template, I found the font used for h1 and h2 text to be difficult to read due to its slim design - Century Gothic. However, I prefer using Noteworthy, a font available on my Mac. I converted Noteworthy from OTF to web-font st ...

What is the best way to create a straightforward menu for my HTML game?

I have been working on a basic HTML game and it seems to be functioning more or less. I'm wondering if it's possible to create a simple menu with an image in the background and a "click to start" button within the same file. Any suggestions or ti ...

Insert text into the cursor location within Summernote using JQuery

Currently, I am working on a flutter application where I have implemented the summernote editor using JQuery. ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); String txtIsi = data.text .replaceAll("'", '\&bsol ...

What could be causing my JavaScript/jQuery code to malfunction when dealing with checkboxes?

My code is supposed to select and disable checkboxes based on which radio button is clicked. For example, when Zero is selected, all checkboxes should be highlighted and disabled, except for the zeroth checkbox. However, this behavior does not consistent ...

Steps to reveal a hidden div when clicking on another div using CSS exclusively

Is it possible to reveal a hidden div when another div is clicked using only CSS? Below is the HTML code: <div id="contentmenu"> <div class="show"> <a class="show"> My Student ...

Tips for setting up the information in a Bootstrap popover

I am currently working on a Google web app that involves Google Sheets data. My objective is to have the data displayed when hovering over a button, but instead, the data appears directly on the button without the hover display. What might I have done in ...

How can we use the nth-of-type selector to target a set of eight elements in a

I am trying to style a group of divs in such a way that every set of eight elements will have the same left positioning. Rather than just styling every eighth element individually, I want to apply the styling to groups of eight elements at once. However, ...

What is the best way to apply an animation class to a modal upon clicking a button?

When I click the "x" button on the modal, I want the animation to occur. However, what currently happens is that the modal closes without the animation. Then, upon reopening the modal, the animation occurs without any clicking involved. Below is my curren ...

The order of event handlers in jQuery

I am currently setting up event binding for a text element dynamically. Take a look at the following code snippet: <input type="text" id="myTxt" /> <script type="text/javascript"> function attachEvent1(element){ element.keyup(func ...

Adjust image size based on window dimensions changes

Let me demonstrate the issue I'm facing with this demo. This demo shows a simple list of images that scrolls across the page. When you click on an image, a larger version appears above it in a lightbox style. I want the height of this larger image ...