473,799 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Center UL within a div

code green
1,726 Recognized Expert Top Contributor
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 3621
drhowarddrfine
7,435 Recognized Expert Expert
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 Recognized Expert Expert
double post
May 20 '10 #3
code green
1,726 Recognized Expert Top Contributor
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 Recognized Expert Expert
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 Recognized Expert Top Contributor
Thanks drhowarddrfine. That worked!
May 21 '10 #6

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

Similar topics

27
9257
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
26876
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
4200
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 thumbnail pictures) that will possibly be displaying different sized images within a table. The following code almost :) works correctly in I.E. (I'd like the images centered in the table vertically and horizontally) but does not work in...
2
1677
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 command for writing some text is as follows if I am correct: document.write('This is some text');
1
1810
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 kept getting SQL1131 whenever I tried to prepared a stored procedure. As a result, I completely deleted DB2 and reinstalled version 8 and upgraded to FP8. At that point, I experimented a bit with some of the Environment Settings, particularly the...
0
906
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 article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingtemplatesprogrammaticallyindatagridcontrol.asp Thank you,
3
7854
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, and the images in them aren't all the same size. So I've sized the boxes to mach the largest of them, and I want to center them, so those that are smaller will be in the middle of the first div. Here's the code on the page: <table border="0"...
2
16419
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 to overlap correctly. You can see it on this page: www.creativekaysjewelry.com The images overlap exactly how I wanted and in the right position
2
7211
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 other pages) as an unordered list, with the <ulitem being linked to an ID that sets layout, etc., and each <lilinked to an ID that renders its box a different height. So far, body looks as follows: <body>
3
1661
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 Answers.txt can be in different folders depending on where users have installed it, so I'm wondering if I can make the script search within its own folder? That way people would be able to simply place the two in the same folder and not have to...
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10475
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10222
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9068
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.