473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Center UL within a div

code green
1,726 Expert 1GB
I have this piece of code
Expand|Select|Wrap|Line Numbers
  1. <div style="text-align:center" id="nav">    
  2. <h1>Stocktake Menu</h1>
  3. <ul>           
  4. <li> <a href="HTML/upload.html" 
  5.     title="Upload Spreadsheet and Check Integrity">
  6.     Check Spreadsheet</a></li>
  7. <li> <a href="scripts/insertStock.php"
  8.     title="Upload Data from Spreadsheet">
  9.     Upload Figures</a></li>
  10. <li> <a href="scripts/zeroise.php"
  11.     title="Zeroise the Store the Current Spreadsheet Relates to">
  12.     Zero Store</a></li>
  13. </ul>     
  14. </div>
Which used to align evenly in IE 7, but in IE8 it looks like this
Expand|Select|Wrap|Line Numbers
  1.                   Stocktake Menu
  2.            Check Spreadsheet
  3.               Upload Figures
  4.                 Zeroise Bin
That is the menu items no longer sit centrally under the heading but have shifted left but still obviously centered to something

Anybody any idea why this is?
May 20 '10 #1
5 3607
drhowarddrfine
7,435 Expert 4TB
IE8 does not work like IE7 compatibility which doesn't work like IE7 which doesn't work like IE6 and none of them work correctly as the other more modern browsers do, so I would suspect IE8s "fixes" fixed something you depended on in IE7 which is more proof of why no one should trust IE to do anything right (and why no one should use IE at all).

This may have to do with how bullets are set up in the <li> or do you have those removed? IE uses margin while others use padding there. Is there any CSS applied to this?

Sorry, I don't have IE handy to check right now.
May 20 '10 #2
drhowarddrfine
7,435 Expert 4TB
double post
May 20 '10 #3
code green
1,726 Expert 1GB
With FF the alignment is slightly better,
the menu items are further to the right but not centrally under the heading.
I can't remember if this is better or worse than previous FF versions.
This is the relevant CSS written by an ex-colleague more savvy in HTML
Expand|Select|Wrap|Line Numbers
  1. #nav li {        
  2.         width: 25em; /* width needed or else Opera goes nuts */
  3.         font-size: 25px;
  4.         list-style: none;
  5.         margin-bottom: 1ex;
  6.     }
Is it the width property doing this?
May 20 '10 #4
drhowarddrfine
7,435 Expert 4TB
Yes. I don't know why he feels that is needed for Opera. Remove that and add to that li 'margin:0; padding:0'
May 20 '10 #5
code green
1,726 Expert 1GB
Thanks drhowarddrfine. That worked!
May 21 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

27
by: FL | last post by:
Hi Everyone, I know howto center a block using margin-left: auto ; margin-right: auto ; but I'm trying to center vertically a box, any idea to solve this?
10
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
1
by: Chris McGarry | last post by:
Hello, I'm new to style sheets and have been fighting with browser compatibility for two days. I'm developing a image selection page (similar to Ebay where the visitor can select and enlarge 1-6...
2
by: MK | last post by:
Hi, I don't have much experience with Javascript and have a simple question. Suppose one wants to write some text in the web page which needs to be center aligned, then how to do it? The...
1
by: Henry Reardon | last post by:
I have been having problems with the Development Center for several days now. It seemed to be working fine when I initially installed DB2 (LUW) Version 8 (FP7) and upgraded to FP8, except that I...
0
by: slemen | last post by:
Hi, I'm creating column templates dynamically at runtime. How do I center within the column 2 check boxes in each column header? The columns are created using the technique described in MSDN...
3
by: rsteph | last post by:
I'm using two divs to create a shadowed-box type effect. Within the top div I want to put an image. I can get the image to center right to left, but not top to bottom. I'm making a series of boxes,...
2
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using...
2
by: David | last post by:
I'm trying to style a kind of minimalist welcome page where each of X number of (gray?) boxes will be links to a part of the site. I want to implement the navbar (ie, set of boxes linking to...
3
by: Ciremo | last post by:
I've made a simple script which asks questions, and writes the answers into a file (Answers.txt) However, the only way I get it to work is to define the entire path, e.g. C:\folder\Answers.txt But...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.