CSS: text positioning issue observed in Mozilla browser

I am facing an issue with the text position inside the box/button element on my website. The text appears correctly in Chrome, but in Firefox, it is positioned above the box, making it difficult to read.

Can someone assist me with fixing the CSS or identifying what I am doing wrong so that the text can be properly placed inside the box element?

<div class="contents grid_26 push_24">
            <ul class="ca-menu">
                <li>
                    <a href="#">

                        <div class="ca-content lft">
                            <h2 class="ca-main">Item 1<img src="images/image_1.png" width="22" height="22" class="arrow"></h2>

                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">

                        <div class="ca-content lft">
                            <h2 class="ca-main">Item 2<img src="images/image_1.png" width="22" height="22" class="arrow"></h2>

                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">

                        <div class="ca-content lft">
                            <h2 class="ca-main">Item 3<img src="images/image_1.png" width="22" height="22" class="arrow1"></h2>

                        </div>
                    </a>
                </li>
</div>

<style>
.ca-main{
font-size: 14px;
position: absolute;
top: -17px;
height: 80px;
width: 120px;
left: 70%;
margin-left: -88px;
opacity: 0.8;
text-align: center;
color: #fff;
text-transform: uppercase;
font-family: "Myriad Pro", "Trebuchet MS", sans-serif;
}

.container_24 .grid_26 {
margin-top: -20px;
}

.container_24 .push_24 {
 margin-left: 0px;
}

.ca-menu li a{
text-align: left;
width: 100%;
height: 100%;
display: block;
color: #333;
position: relative;

}

.ca-menu{
padding: 0 0 0 48px;
margin: 62px auto;
width: 1020px;
cursor: pointer;
}

.ca-menu li{
top: 28px;
left: -140px;
width: 140px;
height: 28px;
border: 3px solid #333;
overflow: hidden;
position: relative;
float:left;
background: #fff;
margin-left:-48px;

-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
/* -webkit-border-radius: 125px; */
-moz-border-radius: 125px;
border-radius: 125px;
}

</style>

Answer №1

Here's a suggestion for you to try:

.ca-menu li a {
    text-align: left;
    width: 100%;
    height: 100%;
    display: inline-block;
    color: #333;
    position: relative;
}

If you're looking to create menus, I recommend using Superfish. It's the optimal solution for building attractive and interactive menus with animations that work seamlessly across browsers.

For your convenience, here is a link to the Superfish plugin: https://github.com/joeldbirch/superfish/

I can attest to its effectiveness - check out the menus I designed at www.santz.net and santz.freeiz.com, both built using this plugin.

I hope this information proves helpful. Feel free to reach out to me here or on my Facebook page if you have any further questions.

Answer №2

One issue is the missing ul closing tag in your HTML code.

Additionally, consider implementing a CSS reset to standardize styles across browsers. A reset stylesheet helps eliminate inconsistencies in default line heights, margins, font sizes, and more.

For more information on CSS resets, check out this helpful resource: CSS Tools: Reset CSS

Answer №3

Your list items are offset by -140px due to the CSS property position: relative; combined with left: -140px;, resulting in them being pushed outside of the screen. This is because no other elements have a position set, making them relate to the root <html> element.

The lack of clearing for floated <li> elements is causing your container div to have no height, as floated elements are not considered unless followed by an element with a clear property. Consider addressing these issues before troubleshooting further.

Additionally, it may be beneficial to validate your page to ensure overall code quality. Prioritizing good CSS practices and understanding these concepts will help prevent similar issues in the future.

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

What is the best way to eliminate spaces, commas, and periods from a variable in javascript?

After attempting var res = str.replace(/ |,|.|/g, ""); and var res = str.replace(/ |,|.|/gi, "");, I'm still puzzled as to what I might be missing. var str = "Text with comma, space, and period."; var res = str.replace(/ |,|.|/g, ""); document.writ ...

What is the best way to display text from a file on a different html page using jQuery's json2html?

Here is the json data: var data = [ { "name": "wiredep", "version": "4.0.0", "link": "https://github.com/taptapship/wiredep", "lice ...

Employing CSS selectors to target the subsequent element that is accessible

Here is the structure of my HTML: <input type = "checkbox" style = "display:none" id = "select"> <label for = "select" id = 'click'> click </label> <div class = 'next'> </div> I am trying to style t ...

Voice recognition feature in the latest version of Chrome on Android devices

When using a PC with Chrome 25 (non beta), I see a microphone icon that prompts for input when clicked. After speaking, my alert call is successfully executed. However, on a Galaxy Note smartphone with Chrome 25 and an Android 4.04 operating system, the sa ...

Modify the text tone within a specific cell

Welcome to my unique webpage where I have implemented a special feature. The text highlighted in red represents the unique identifier for each individual cell. Interestingly, below there is an input field containing the code "0099CC", which corresponds to ...

Getting data from non-input fields in Flask

Seeking some guidance here - struggling to figure out how to extract values from elements other than input fields using Python with Flask. For instance, I'm working with an HTML form containing the following elements: <form action="/newgame" metho ...

The amazingly efficient Chrome quick find feature, accessible by pressing the powerful combination of Ctrl + F, ingeniously

Currently using Google Chrome version 29.0.1547.62 m. I've employed the CSS attribute overflow set to hidden on the parent element, which renders some of my DIV elements hidden from view. Additionally, these concealed DIV elements are adjusted in pos ...

What is the best way to input individual students' CA and exam scores into distinct fields and then calculate their total scores in a separate text field?

As a beginner in jQuery, I am looking for guidance on creating a script that calculates the Total score, Grade, Remark, and Position based on the user input of CAT score and EXAM score. The result should be displayed dynamically once both scores are entere ...

How do I utilize AJAX and HTML to invoke a RESTful web service in Java?

How to call a RESTful webservice in Java using HTML Ajax? I have created a simple webservice in Java and want to POST data into a database using HTML Ajax by calling a Java webservice in Eclipse. However, I encountered an error in my Java program. How can ...

Sass flex order has no effect on elements that are generated

I encountered an issue with the rendering of SVGs in my project. Currently, they are displayed correctly in desktop mode, but in mobile portrait mode, I need to change the order of one specific SVG element within the row. To achieve this, I decided to use ...

Tips for sending a Python email with attachment and including an HTML body along with an alternative plain text body

Using Python, I have developed code to send emails with HTML bodies and attachments. Additionally, I would like to include a plain text email body for clients that cannot display HTML content properly. While my code works in most cases, I've encounter ...

Is it possible to designate touch as the top finger and always have touch 2 be the bottom finger on the screen?

Is there a way to specify touch1 as the upper finger on the screen and always have touch2 as the lower finger, even if the lower touch is detected first? var touch1 = e.originalEvent.touches["0"]; var touch2 = e.originalEvent.touches["1"]; Can these ...

Choose a class and all its offspring as a selector

I possess the subsequent <label class="noblock"> <input> ... ... </label> Is there a method to indicate the CSS property display: inline for both the class noblock and its offspring (all elements within it)? ...

Anticipated spatial glitch problem involving the gadicc/meteor-reactive-window package for Meteor

Utilizing the gadicc/meteor-reactive-window Meteor Package to switch templates based on screen size. This file is named pictureDisplatSection.html <template name="pictureDisplaySection"> <div class="display"> ...

Distinguishing Design with CSS3

Here is the code snippet I am using: <table width="562" cellspacing="0" cellpadding="0" border="0" align="center" class="genericClass"> (nested tags are here) </table> These are the related styles in my stylesheet: table.genericClass a ...

Ways to incorporate CSS design into Django input pop-up when the input is invalid

Looking to enhance the error message styling for a Django Form CharField when an incorrect length is entered, using CSS (Bootstrap classes preferred). I have successfully styled the text input itself (check the attrs section in the code), but I am unsure ...

Problem with onblur and onchange events not being triggered in input tag

After encountering this issue, I came to the realization that the events onblur and onchange function properly. However, I noticed that if your page contains only ONE <input type="text" onblur="loadXMLDoc()"> Change Content</input> The behav ...

In Vue, it is not accurate to measure overflow

I am working on creating an overflow effect with tagging that fades out at the beginning to provide a subtle hint to users that there is more content. Here is what it currently looks like: https://i.stack.imgur.com/fXGBR.png To achieve this, I added a fa ...

Issues with CSS animation functionality have been detected in the Edge browser

In this particular div, I have two spans enclosed. I've created a loader which features a circle filling up with red color repeatedly. While everything appears to be functioning smoothly in Google Chrome, there's a noticeable glitch when it comes ...

Issue with setting innerHTML of element in AngularJS app upon ng-click event

Look at this block of HTML: <div class="custom-select"> <div class="custom-select-placeholder"> <span id="placeholder-pages">Display all items</span> </div> <ul class="custom-select- ...