Search code examples
htmlcsspositioning

CSS: text position not correct in mozilla browser


My question is that i have these buttons Item 1, Item 2 etc. on my site, now the text position inside the box/button element are at correct position for Chrome but on Firefox they show some problem and gets placed somewhere above the box where the text is not properly visible.

Could someone please help with the CSS or whatever else im going wrong so that i can place the text inside the box element at the correct position.

<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>

Solution

  • I would suggest you to try this:

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

    However, to build menus I suggest you use Superfish. It's the best way tp create nice and interactive menus with animations and full browser compatibility.

    I'll even leave you the link to make you thing more easy: https://github.com/joeldbirch/superfish/

    Believe me, it's great. Look what I made: www.santz.net and santz.freeiz.com

    I developed both menus using this plugin and it's great.

    Hope I have helped, any doublt contact me through here or with my Facebook page.