What could be the reason that I am unable to absolutely position generated content in Firefox?

I am currently designing a horizontal navigation bar and here is the CSS I have used:

#topnav {
    clear: both;
    overflow: hidden;
    display: table;
}

#topnav ul {
    display: table-row;
}

#topnav ul li {
    display: table-cell;
    vertical-align: middle;
    background: #1b4260;
    position: relative;
}

#topnav a {
    display: block;
    color: white;
    padding: 10px 0px 15px 10px;
    font-size: 14px;
    width: 100px;
    text-align: center;
}

#topnav ul li+li:before{
    content: "*";
    position: absolute;
    top: 11px;
    color: #ff0000;
    float: left;
}

And this is the corresponding HTML code:

<p>---</p>
<p>---</p>
<div id="topnav">
    <ul>
        <li>
            <a href="blah">Item 1</a>
        </li>
        <li>
            <a href="blah">Item 2</a>
        </li>
        <li>
            <a href="blah">Item 3</a>
        </li>
    </ul>
</div>

The navigation bar includes little asterisk separators but unfortunately, it does not render correctly in Firefox as it seems to ignore the "position: absolute" property on the generated content:

I'm puzzled by this behavior. Could there be something wrong with my CSS?

Answer №1

To properly display the ul, make sure to also position it:

#topnav ul {
    display: table-row;
    position:absolute;
}

For a visual demonstration, check out this link: http://jsfiddle.net/k5hVP/1/

Answer №2

Although not the most perfect solution, I managed to accomplish it without setting the position to top and without absolutely positioning the ul. By eliminating the top positioning and using a margin-top, you can adjust the position of the asterisk.

Check out this link for a demonstration.

I have some reservations about Jani's approach because theoretically, setting position:relative should work as well (and would be a less disruptive solution). However, in this case it doesn't, indicating that the solution is not related to normal positioning priorities but rather relies on an odd way Firefox handles positioning priority.

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

disappearance of background image at bootstrap breakpoint

Hey there, I'm diving into a new journey in web design and I've encountered my first newbie issue. I'm attempting to place an image and text side by side on my web layout, but as soon as the breakpoint hits below 560px, the image disappears ...

Is there a way to achieve a similar outcome on my site?

Recently, I noticed a mouse-hover effect on two websites and found it quite appealing. https://i.sstatic.net/Ly0gP.png https://i.sstatic.net/oDe1i.png This is the specific effect that caught my attention. Can anyone provide me with insight on how to impl ...

links to css and javascript

I am having trouble with what should be a simple task! On my webpage, I have this link: <a class='action' href='javascript:void(0)' OnClick='run()'> run </a> Along with the following CSS: .action { color: # ...

The sizing of elements in Firefox seems to be off when using percentage

I am facing an issue with a page that has 3 td elements all set at a width of 33.333333%. In Firefox, the browser seems to be computing it as an actual pixel value of 568px, causing the containers to run off the page. I have not defined any fixed widths in ...

Alignment of label not remaining centered vertically, issue with bootstrap

Struggling with getting this label to stay centered vertically? It always seems to appear at the top. Any help would be greatly appreciated. Thank you! Check out the code here <div class="container"> <div class="row"> <div clas ...

Animated mosaic pattern menu design

Is there a way to achieve this effect with a sketch? Note: I would like to add hover animation to the borders if possible. I attempted to do it using the following code: clip-path: polygon(0 0, 100% 0, 92% 86%, 6% 100%); However, the shapes created by ...

The vertical shift in one of the inline table cell DIVs is being caused by two of them

I've been searching for a solution to my issue, but have come up empty-handed. I apologize if this has already been discussed before. My HTML page contains a section that appears as follows: <div id=wrap> <div id=lb> Content ...

Maintain the aspect ratio of an image within a flex container when the height is adjusted

I'm currently facing an issue with an image in a flex container. My goal is to maintain the image's ratio when the height of the container or window is decreased or resized. Check out this sample fiddle html, body { height: 100%; } .wrappe ...

Background image fixed with scrolling effect

I've been struggling with a parallax effect on my website. After seeing it work smoothly on other websites, I tried to implement it myself but couldn't quite get it right. The background image keeps moving when I scroll the page and I want it to ...

What could be the reason behind the malfunctioning of my media query in the

I am trying to connect an external stylesheet to my React component in order to apply different styles based on screen width. Specifically, when the screen width is less than 300px, I want the logo to have a height of 100vh. However, it seems that the medi ...

Adjusting the alignment of text using the "=" symbol

Can you help me align text with the "=" sign, just like in the image below? https://i.sstatic.net/L53k2.png I know I can achieve this using mathjax, but I'd prefer to do it with CSS. However, my current method isn't producing aligned equal sign ...

Text box input that displays the latter portion before the initial part

Looking for assistance with showing the end of the entered text rather than the beginning in an input field. For example, the input could be "Starting portion, Ending Portion". If the input field is limited to 14 characters, instead of displaying the firs ...

Anomaly in SVG Animation Performance

My SVG animation was going smoothly until the final element, which unfortunately ruins the entire thing. What I've created is a hexagon composed of 6 individual triangles, designed to fold out and back in on a continuous loop for use as a loader anim ...

Establish a connection with a browser that is already running

Is there a way to use Selenium to connect to a browser that is already open, such as Firefox? Specific Conditions: The user has manually clicked on the browser icon. No new window should be opened when using Selenium. For example, if a user wants to l ...

Struggling to achieve a horizontal scroll using 'overflowX' in MUI, but unfortunately, it's not functioning as expected

Is there a way to create a properly-sized card with a horizontal scrollbar in a paper format? I've tried using 'overflow' but it doesn't seem to be working in this scenario. import React from 'react'; import { makeStyles } fro ...

Does the Android 4.3 Internet browser not support @font-face declarations?

After my Samsung Galaxy S3 phone recently updated from Android 4.1.3 to Android 4.3, I noticed that some of the websites I designed are not displaying the fonts correctly. These sites were tested on the Android internet browser and use @font-face. How can ...

ReactJS not displaying the class effect as intended

When using the react zoom pan pinch library, I am trying to set the height to "100%" for TransformWrapper and TransformComponent. Interestingly, it works perfectly fine when done through Chrome inspect, but when attempting to add a className or use style={ ...

Implementing a dropdown menu within a Bootstrap navbar

Currently, I am working on developing a website and decided to kickstart the project by using the dashboard example provided on the Bootstrap website. However, I encountered an issue when trying to integrate a dropdown into the navbar. It seems that the dr ...

Unlocking the Power of Dynamic Title Text in Your Content

Recently, I came across a tooltip code on Stack Overflow which I have been using. The issue I am facing is that the text in the title section is hardcoded and I need to customize it for different labels. How can I modify the code to make it flexible enough ...

Toggle the visibility of items based on the user's login status

Below is the code snippet for when the user is logged out: <div class="fusion-secondary-main-menu"> <div class="fusion-row"> <?php avada_main_menu(); ?> <?php avada_mobile_menu_search( ...