The CSS tag combination of 'position:relative;' and 'top:xx%;;' functions properly in Chrome, however, it does not work in any non-webkit browsers such as Firefox, Internet Explorer, Opera, etc

Encountering some strange behavior with a simple piece of code that I can't seem to figure out! I am trying to position a footer navigation at the bottom of my page using 'position:relative;' and it works perfectly in Chrome. However, in FF (or any other non-webkit browser), the navigation bar is almost at the top of the page instead of the bottom. If I change the CSS line from 'position:relative' to 'position:absolute', it works in all browsers but doesn't float correctly when resizing or zooming the screen. Even with a basic HTML/CSS setup and proper browser resets, I still face the same issue. This is all happening on Windows 7. Below are snippets of the code. Can anyone help me understand why this isn't working? Any solutions on how to make a simple footer navigation work across all browsers and float correctly while zooming will be greatly appreciated!


<ul id="avmenu">
  <li class="current"><a href="first.html">First page</a></li>
  <li><a href="second.html">Second page</a></li>
  <li><a href="third.html">Third page</a></li>
  <li><a href="fourth.html">Fourth page</a></li>
  <li><a href="fifth.html">Fifth page</a></li>
</ul>

ul#avmenu {
margin: 35px 0;
padding: 0;
font: 12px Verdana;
list-style-type: none;

position:relative; <---As is this works in chrome only.  JUST CHANGE THIS to position:absolute and it works in all browsers but it doesn't float well resizing or zooming.

top:70%;  <--This only works ONLY in CHROME when above position:relative.  Work improperly whhn position: absolute.
*left:20%;
}

ul#avmenu li {
display: inline;
}

ul#avmenu li a {
padding: 5px 10px;
border: 1px solid #aaa;
background-color: #eee;
color: #47a;
text-decoration: none;
}

Answer №1

If you're looking for a solution, check out this link: http://jsfiddle.net/panchroma/u9qtd/

In order to achieve this effect, I have adjusted the body height to be full. Depending on your page's layout, you may need to customize this further.

For a deeper understanding of relative versus absolute positioning, refer to this enlightening discussion: Position Relative vs Position Absolute?

CSS

html, body {
height: 100%;
} 

ul#avmenu {
margin: 35px 0;
padding: 0;
font: 12px Verdana;
list-style-type: none;

position:relative; 

top:70%; 
left:20%;   
}

ul#avmenu li {
display: inline;
}

ul#avmenu li a {
padding: 5px 10px;
border: 1px solid #aaa;
background-color: #eee;
color: #47a;
text-decoration: none;
}

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

Tips for adjusting the width of a field within an existing OpenERP7 form view utilizing percentages instead of pixels

In the process of modifying a form view on OpenERP7 through inheritance, I am attempting to adjust the width of a field to 50% (currently at 40%). While I have successfully altered the style and width of the field using pixels, any attempt to input a perce ...

Tips for uncovering a concealed div within an iframe?

It's as if there's a mystery surrounding how to reach this elusive div... div#someId iframe html>head>body div.wrapper div.footer Naturally, my strategy: #someId iframe body .footer is proving to be ineffective. ...

Unable to implement CSS styles on the provided HTML code

I'm currently working on integrating evoPDF into my asp.net application. When I click on a part of the HTML file, I send that portion using AJAX. So far, everything is working well up to this point. However, when I try to use the following methods fro ...

Take away the attention from the span element

I have been experimenting with the following jsfiddle and attempted various methods suggested in this Stack Overflow thread, but I am struggling to remove the focus from the "feedback" span after clicking on the cancel button in jQuery confirm dialog. Her ...

Unique solution: "Using CSS to ensure the overflow document always scrolls to the bottom

Is there a way in CSS to make a div with overflow: scroll always automatically scroll to the bottom along the Y-axis, regardless of its content? For example, like a chat thread that consistently displays the latest message at the bottom. I've encount ...

Tips on adjusting the scrollbar color with CSS

Check out my jsfiddle here I am attempting to modify the color of the scrollbar, but unfortunately it is not working as expected. This is the CSS code I am using: .flexcroll { scrollbar-face-color: #367CD2; scrollbar-shadow-color: #FFFFFF; ...

Implementing jQuery to enable the selection of multiple options depending on user input

Assume that when the people input value is 1, then the options for values 1 and 2 will be selectable. However, if the people value is greater than 1, then all other options will become selectable. Is it feasible to enable multiple select options based on ...

Which is the superior choice: WebSocket-Node or ws? Additionally, is there a universally accepted interface for nodejs websockets available?

I am considering switching from socket.io to regular websockets in order to utilize binary data transfers and eliminate the need for base64 encoding. There are two primary websocket libraries for nodejs available on GitHub: Worlize/WebSocket-Node einaro ...

How to enhance your jQuery Gallery with clickable images?

I have recently integrated a jQuery Gallery into my website. While everything is functioning properly, I am looking to transform the gallery images into clickable links that lead to higher quality versions of the images. Below is the code snippet for the g ...

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

Establishing the default scroll position in tables using React.js

How can I set the initial scroll in ReactJS Material-UI tables? I'm working with a table that has numerous columns and I would like to have specific columns in view automatically without having to scroll, essentially establishing an initial scroll. I ...

Identifying a flaw in an HTML5 video

I am attempting to identify when an error occurs while playing an HTML5 video. Specifically, I am encountering a situation where I am trying to play an HLS video on a MAC (where "canPlayType" is at least "maybe"), but the video will not play for unknown r ...

What is the best way to verify the status codes of multiple URLs using JavaScript?

In my JavaScript project, I am currently checking the status codes of various URLs. While I can successfully check the status for one URL at a time by writing the code manually, I am facing an issue as I have over 100 URLs to check. This is making my cod ...

Is there a way for me to remove an uploaded image from the system

Here is an example of my HTML code: <input type='file' multiple/> <?php for($i=0;$i<5; $i++) { ?> <div class="img-container" id="box<?php echo $i ?>"> <button style="display: none;" type="submit" cl ...

An effective method for transferring form input and music between pages utilizing JavaScript

I've been grappling with this issue for quite some time now. On the initial page, I have a form like this: <form id="user" name="user" method="GET" action="the-tell-tale-heart.html"> Name: <input type="text" name="name"> & ...

Outlook's limited width is causing images to exceed the boundaries of the HTML email

I have a collection of images that display perfectly in Gmail, but when viewed in Outlook, all five images appear within a single <tr> and cause the table width to expand. My desired layout is to have the first four images centered on the first line ...

Upgrade button-group to dropdown on small screens using Bootstrap 4

I am currently developing a web application and incorporating Bootstrap 4 for certain components such as forms and tables. Within the design, I have included buttons grouped together to display various actions. Below is an example code snippet: <li ...

Displaying a div on click is simple with CSS and JQuery, but what if you want it to stay visible even after a second click? By utilizing classes within <li> tags instead of buttons

My current code involves clicking on a menu, which should reveal a list where each item has a corresponding section that slides down and slides back up when clicked. However, only the sliding down functionality is working at the moment. I'm new to jQu ...

Use jQuery to replace this color with that color in CSS every time it appears

I have numerous div elements, some with a background-color: #aaa, others with font color: #aaa, and some with border-color: #aaa. There are also divs with various other colors. I am looking to update these colors (#aaa) to #ccc throughout the CSS. While ...

Angular's parent div height can be adjusted using CSS transitions

I have implemented a CSS transition to create a sliding effect in my pagination. However, I am facing an issue where the height of the containing div changes even when I set the position of the transitioned elements. Here is a snippet of my CSS: .slide { ...