The absolute positioning is causing the <UL> <LI> elements to malfunction

Hello I have encountered an issue with the bootstrap menu that I am using. The first link is not functioning properly due to the position: absolute; attribute of the <li> element. Any suggestions on how to resolve this would be greatly appreciated. Interestingly, when I remove the position attribute, the second and third links stop working as well.

Here is my CSS code:

.navbar-inverse { background:#000; height:82px;}

/* menu */

#navlist {
    position: relative;
    display: block;
}

#navlist li {
    margin: 0;
    padding: 0;
    list-style: none;
    display:inline-block;
    position: absolute;
    top:10px;
    font-family: 'Open Sans', sans-serif;
    font-size:11px;
    font-weight:600;

}

#navlist li, #navlist a {

    height: 94px;
    width: 94px;
    display: block;
    padding:0px;
    margin:auto;  
    text-align: center;
}

#sprite_01 { text-align:center; display:inline-block; width:42px; height:41px; background:url('../images/butons_sprites.png') 0 0;}
.link_01:hover #sprite_01{background:url('../images/butons_sprites.png') 0 -41px;}
.link_01 {left:0px;}

#sprite_02 {text-align:center; display:inline-block; width:42px; height:41px; background:url('../images/butons_sprites.png') -42px 0;}
.link_02 {left:94px;}
.link_02:hover #sprite_02{background:url('../images/butons_sprites.png') -42px -41px;}

#sprite_03 {text-align:center; display:inline-block; width:42px; height:41px; background:url('../images/butons_sprites.png') -84px 0;}
.link_03 {left:184px;}
.link_03:hover #sprite_03{background:url('../images/butons_sprites.png') -84px -41px;}

#sprite_04 {text-align:center; display:inline-block; width:42px; height:41px; background:url('../images/butons_sprites.png') -126px 0;}
.link_04 {left:274px;}
.link_04:hover #sprite_04{background:url('../images/butons_sprites.png') -126px -41px;}

#sprite_05 {text-align:center; display:inline-block; width:42px; height:41px; background:url('../images/butons_sprites.png') -168px 0;}
.link_05 {left:364px;}
.link_05:hover #sprite_05{background:url('../images/butons_sprites.png') -168px -41px;}

#sprite_06 {text-align:center; display:inline-block; width:42px; height:41px; background:url('../images/butons_sprites.png') -210px 0;}
.link_06 {left:454px;}
.link_06:hover #sprite_06{background:url('../images/butons_sprites.png') -210px -41px;}

This is the Menu CODE:

Toggle navigation

<div id="navbar" class="collapse navbar-collapse">
      <ul class="nav navbar-nav" id="navlist">

         <li><a class="link_01" href="cursos.php"> 
         <span id="sprite_01"></span> 
         <div class="globalnav__sitemap__item__title">
         <div class="globalnav__sitemap__item__title__text">Cursos</div>
         </div>
         </a></li>

         <li><a class="link_02" href="recetas.php"> 
         <span id="sprite_02"></span> 
         <div class="globalnav__sitemap__item__title">
         <div class="globalnav__sitemap__item__title__text">Recetas</div>
         </div>
         </a></li>

         <li><a class="link_03" href="sabias.php"> 
         <span id="sprite_03"></span> 
         <div class="globalnav__sitemap__item__title">
         <div class="globalnav__sitemap__item__title__text">Sabias Que</div>
         </div>
         </a></li>

         <li><a class="link_04" href="users.php"> 
         <span id="sprite_04"></span> 
         <div class="globalnav__sitemap__item__title">
         <div class="globalnav__sitemap__item__title__text">Usuarios</div>
         </div>
         </a></li>

         <li><a class="link_05" href="marcas.php"> 
         <span id="sprite_05"></span> 
         <div class="globalnav__sitemap__item__title">
         <div class="globalnav__sitemap__item__title__text">Nuestras Marcas</div>
         </div>
         </a></li>

         <li><a class="link_06" href="archivo.php"> 
         <span id="sprite_06"></span> 
         <div class="globalnav__sitemap__item__title">
         <div class="globalnav__sitemap__item__title__text">Archivo</div>
         </div>
         </a></li>

      </ul>
    </div><!-- /.nav-collapse -->

Answer №1

What was the reasoning behind setting the li element to absolute positioning? Have you experimented with using relative positioning on the parent element and setting it to position:absolute instead?

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

A guide on locating the row number of a table with Selenium Webdriver in Java

I have a table that contains multiple rows and columns. Here is an example of the HTML code: <!-- language: lang-html --> <div id="ScheduleTable-01" class="widget Scheduletable suppress-errors Schedule-grid" data-widget="ScheduleTable"> ...

What is the sequence in which the browser handles CSS?

I have a specific class that is being styled in multiple places on my website. I am curious about the order in which the browser reads and applies these different styles. Can you explain this process to me? Inline Style <div class="yellowtag" sty ...

The validity of AngularJS form is constant and always returns true with formName.$valid

I am facing an issue with my Angular application form where even though the input fields are blank, formName.$valid is always true. Below is the HTML code for my form: <form name="contactForm" novalidate ng-submit="processForm(formData)" autocomplete=" ...

Unable to choose radio button again

Check out this fun web quiz I created! I'm having some trouble with the back button functionality. Whenever a user clicks back, I want to restore their previous choice but for some reason it's not working as expected. Take a look at my go_back ...

Guide to switch background image using querySelector

I am currently trying to figure out how to set the background image of a div block by using querySelector. I have attempted various methods in my test code below, but unfortunately none seem to be working. Can someone please provide assistance? <!DOC ...

Unexpected display issues with CSS shapes in Bootstrap framework

Been experimenting with creating custom shapes in Bootstrap - they display correctly in HTML and CSS, but Bootstrap distorts them. It seems like there are no conflicting classes. Could it be necessary to use '!important' on some of the elements? ...

I'm struggling to determine the source of the color for my linked CSS. Any ideas where to look?

I am experiencing an issue with a link that is displaying as white and gray for "a" and "a:hover", despite my CSS file specifying otherwise. Firebug confirms this, but I can't figure out what is overriding it. Can anyone offer any insight? Below is t ...

The responsiveness of Slick Slider's breakpoints is malfunctioning

After implementing a slider using slick slider, I encountered an issue with the width when testing it online and in a normal HTML file. If anyone could assist me in resolving this issue, I would greatly appreciate it. Please inspect the code for both scen ...

Show a few values as a string in Angular using Typescript

I am working with JSON data and I want to know how to display hobbies without including the word "all" in an Angular/TypeScript application. { "Name": "Mustermann1", "Vorname": "Max1", "maennlich& ...

What is the best way to display all HTML content using PHP?

I have an HTML page with a multitude of CSS and JavaScript tags in its head section. My goal is to print them as they are on a PHP page. I've attempted using PHP echo file_get_contents("html_url"); and the fread function. The PHP page successfully loa ...

Ensure that FlexBox Columns have a height of 100% and vertically align their content

Having scoured through numerous questions and answers, I'm still stuck on why I can't achieve 100% height for certain flexbox columns. Specifically, trying to make the "Genre" column with one line of text match the height of the "Song & The A ...

How to Link Django URL to an HTML Button

I have the following URL defined in my urls.py file: url(r'^inline-formset/$', 'order.views.addrow', {'form_class': OrderedItemForm}, name='addrow'), Now, I want to link to this URL from a form button, but I am str ...

Error parsing in Visual Studio 2012

I have included the following code in my master page: <link rel='stylesheet' id='layer-styles-css' href='css/layerslider.css?ver=3.4.1' type='text/css' media='all' /> When debugging in MS Vis ...

Connect two cells in a table by incorporating a vertical line in between the rows. Merge header cells

I have incorporated some simple HTML tables on my website and I am encountering two issues that I need assistance with. 1) After adding these tables to my subpage, I noticed that the tables look almost identical but have their horizontal line between tab ...

Missing or Lost Values in Object-Oriented PHP Arrays

I am fairly new to object-oriented PHP and PHP in general. I have a class where I assign array values in the constructor, but later when I try to access the array, it shows as null. Any ideas why this might be happening? Could it be an issue with scope? c ...

The image link extends across the entire width of the page

Check out this code snippet: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <style> img{ height: 800px; display: block; margin:auto; } </style> </head> <body&g ...

Issue with typography upon initial page load

Hey everyone! I recently completed a crash course in html, css, and javascript within just one month. However, I encountered an issue while using canvas to draw text with a custom font. The font didn't load the first time I ran the code, but strangely ...

Why is it that my JQuery sliders appear perfectly fine when viewed locally, but fail to show up when accessed on

I'm facing an issue with two JQuery sliders on my page. The local version works fine, but when I upload it to my web host, only one slider functions correctly. I need both of them to work as intended. Any insights on how to resolve this problem? See ...

The mouse coordinates do not align with the drawing of a rectangle on the canvas

I am having some issues with drawing a rectangle on mouse drag over the canvas that is overlayed on an HTML5 video JS player. The rectangle is being drawn, but it does not align correctly with the mouse coordinates. I suspect that the canvas, which is ove ...

Jupyter QtConsole: Customize default CSS by selecting from built-in options in the configuration settings

I am currently using Jupyter on a Windows platform and I am looking to customize the coloring of the QT console. Is there a way to set a default CSS style through a configuration file without having to manually specify it every time? Instead of passing t ...