The navigation bar struggles to display list elements without proper line breaks

Recently, I've been immersed in a web development project for a company. For the navigation bar, I opted to use the FlexNav JQuery plugin. While referencing the example on , I encountered an issue when attempting to add more than 5 list elements; they kept jumping to the next line inexplicably. Is this a result of faulty HTML or CSS? It doesn't seem like a table-related problem, as it appears that either the JavaScript or CSS automatically forces a line break after 5 elements, regardless of the HTML structure.

I suspect the root of the issue lies within these code snippets:

 .flexnav {
   -webkit-transition: none;
   -moz-transition: none;
   -ms-transition: none;
   transition: none;
   -webkit-transform-style: preserve-3d;
   overflow: hidden;
   margin: 10 auto;
   width: 70%;
   max-height: 0;
 }

 .flexnav.opacity {
   opacity: 0;
 }

 .flexnav.flexnav-show {
   max-height: 2000px;
   opacity: 1;
   -webkit-transition: all .5s ease-in-out;
   -moz-transition: all .5s ease-in-out;
   -ms-transition: all .5s ease-in-out;
   transition: all .5s ease-in-out;
 }

 .flexnav.one-page {
   position: relative;
   top: 50px;
   right: 5%;
   max-width: 200px;
 }

 .flexnav li {
   font-size: 100%;
   position: relative;
 }

If interested, here is a link to my source code: http://codepen.io/xjokes_henry/pen/grOwBe

Answer №1

If you want to adjust the size of the li element in the CSS, make sure to change the width to 16 within this code block (line 182):

.flexnav li {
  position: relative;
  list-style: none;
  float: left;
  display: block;
  background-color: #a6a6a2;
  overflow: visible;
  width: 16%;// 20 changed to 16 to fit one additional element
}

For future reference, consider using debugging tools like Chrome or Firefox (press f12) to inspect and edit CSS or HTML elements.

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

Sharing package JSON file dependencies with child engines and addons in Ember.js

I am seeking information on how Ember Js can share the parent app's package.json file dependency (xyz:3.0.0) with child engines and addons without them needing to redeclare the dependencies in their own package.json files. This is to reduce the overal ...

Explanation for aligning anchors within an HTML <div>

I'm faced with this HTML snippet: <div class="row"> <div class="col-md-10 social-icons"> <a href="https://www.youtube.com/" target="_blank"><img src="/images/youtube-i.png"></a> <a href="https://gi ...

Tips for creating a clickable A href link in the menu bar that triggers an accordion to open in the body when clicked - html

Is there a way to open the first accordion when clicking on the "open 1st accordion" link, and do the same for the second link? The accordions themselves work perfectly fine, I just need a way to trigger them from outside their scope by clicking on links i ...

Jquery failing to function properly when scrolling

I have been attempting to implement a feature where an element changes its position to fixed after scrolling past a certain point. However, no change occurs when I scroll. In the <head> section of my code, I have included <script src="stiler/jquer ...

How to Preserve Image Aspect Ratio within a Div Using the 'Overflow: Hidden' CSS Property

I am in the process of creating a profile page that takes inspiration from Facebook's layout design, particularly focusing on the banner and profile image combination. While my implementation looks good on desktop screens, I am facing challenges when ...

The custom stylesheet added to index.html is not taking precedence over the Bootstrap 5 styles applied through NPM

In my Vue 2 project, I encountered an issue with Bootstrap 5.3 when installed via NPM. My custom CSS stylesheet in the index.html file was not able to override Bootstrap's CSS. Interestingly, I faced no problems when using Bootstrap from a CDN. Addit ...

Ways to restrict the content div JSON display to only three items

Is it possible to limit the display of items from JSON in the content div to just three? The current code displays all downloaded items, but I want only 3 divs to be returned. <div id="p"></div> $.getJSON('element.json', function(d ...

None of the angular directives are functioning properly in this code. The function attached to the submit button is not executing as expected

I've experimented with various Angular directives in this code, but none seem to be functioning properly. I'm wondering if a library file is missing or if there's some issue within the code itself, potentially related to the jQuery file. The ...

Optimizing jqGrid: Enhancing saveRow function to properly synchronize with editRow function

Exploring how to customize jqGrid's add function for my own needs. I have a navButton with specific requirements: When the user clicks the button, a new row in edit mode should appear on the grid. Once the user enters data and presses enter, the dat ...

Issue with the progress bar bouncing back and forth

I am encountering an issue with my progress bar width changing on nav-links click. When I click on each nav-link, the progress bar reaches its width correctly but then turns back and forth unexpectedly. I am unsure why this is happening. Here is the code ...

Foundation framework enables the creation of a full width footer that stands out

I'm having trouble getting my footer panel to stretch across the entire page, it seems stuck in the center. The header at the top of the page spans the full width just fine. Am I missing something? My goal is to make both panels at the bottom of the p ...

Submitting an ASP.NET MVC form with jQuery and passing parameters

Having trouble passing the ThreadId parameter when submitting a form to my controller through jQuery Ajax. The code works fine, but for some reason, the ThreadId doesn't get passed using form.serialize(). Any suggestions on how to effectively pass par ...

Concealing the side navigation menu with HTML and CSS

Hey there, I'm trying to make my navbar automatically hide when the mouse is moved. I found an example that I want to use here. Despite reading some online documentation, I just can't seem to figure out how to do it. Here's a snippet of my c ...

Troubleshooting: Unable to execute a jQuery search in the database after applying accent-neutralization in datatables

Greetings, I am working with a table using the DataTables jQuery plugin. In my index.php file in the footer (pages loaded using switch), I have added a script to neutralize accents for search purposes so that I can search without diacritics. However, this ...

Is it possible to dynamically load a specific div when the page loads, relying on the

I am using JQuery SlideUp and slideDown methods to toggle the visibility of panels. How can I load or display the first record's contact information as a default? Currently, it loads blank because I set the panel's display property to none: < ...

`There are two text boxes in a blog post editor within tinyMCE`

I'm currently working on building a blog app using Django. The issue I'm facing is related to the Tinymce editor in the post creation form. Everything works perfectly fine except for one annoying element that shows up within the text box itself. ...

Refresh the current page with jQuery Mobile when it is clicked

I have a multi page template in jQuery Mobile. How can I refresh the current page when clicking on a hyperlink or button? I am using JQM version 1.4.5 Despite trying the code suggested in how to refresh(reload) page when click button in jQuery Mobile, it ...

Tips for showing/hiding textboxes based on select options:

I am currently working on a project that allows users to enter their personal information. I need help figuring out how to show or hide textboxes based on the selection made in a dropdown menu. The dropdown menu in question is for marital status. The opt ...

What is the reason that PHP has the ability to set Cookies but Local Storage does not?

Let's take a step back to the era of cookies, not too far back since they are considered old but still quite relevant. PHP allows you to set and read them even though they are a client-side technology; however, JavaScript can also be used completely o ...

Enhance your Magento store with Ajax-based attribute filters

I am in need of setting up a series of dropdown menus that are interlinked, such as Truck Brand, Truck Model, and Model Years. There will be a dropdown menu for Brand initially, containing all the available options for Truck Brands. Once a Brand is select ...