473,569 Members | 2,761 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

margins on li elements with IE

Hello,

I noticed that IE seems to put some kind of default margins on <li> elements
and the only way to get rid of them seems to be asigning negative margins.
To make things worse, IE5 and IE6 seem to have different defaults. Is there
an elegant way to remove these stupid margins?

Greetings,
Thomas
Jul 20 '05 #1
27 3135
Thomas Mlynarczyk wrote:
I noticed that IE seems to put some kind of default margins on <li> elements
and the only way to get rid of them seems to be asigning negative margins.
To make things worse, IE5 and IE6 seem to have different defaults. Is there
an elegant way to remove these stupid margins?


http://www.alistapart.com/articles/taminglists/

--
Spartanicus
Jul 20 '05 #2
Spartanicus wrote:
Thomas Mlynarczyk wrote:

I noticed that IE seems to put some kind of default margins on <li> elements
and the only way to get rid of them seems to be asigning negative margins.
To make things worse, IE5 and IE6 seem to have different defaults. Is there
an elegant way to remove these stupid margins?

http://www.alistapart.com/articles/taminglists/


In short: applying a 'border-bottom' *or* removing all the spaces
between the elements.

--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #3
Anne van Kesteren wrote:
http://www.alistapart.com/articles/taminglists/

In short: applying a 'border-bottom' *or* removing all the spaces
between the elements.


Teach how to fish.

--
Spartanicus
Jul 20 '05 #4
Spartanicus wrote:
Anne van Kesteren wrote:

http://www.alistapart.com/articles/taminglists/


In short: applying a 'border-bottom' *or* removing all the spaces
between the elements.

Teach how to fish.


You are correct, but from what I can remember, the second method
(removing the spaces), isn't mentioned at all.

--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #5
>>>> http://www.alistapart.com/articles/taminglists/

Thanks for that link - I had been looking for it for some time but couldn't
remember where it was.
In short: applying a 'border-bottom' *or* removing all the spaces
between the elements.


I've put an example of my code online:
http://www.mlynarczyk-webdesign.de/menulist/. These are the problems:

- IE used to leave a space between the menu items, i.e. it made the li
elements a few pixels higher than their contents would require. I added some
negative margins (different ones for IE5 and IE6). Now this seems to work,
even though when I choose a different font size in IE6 (like "smallest" or
"bigger" - but it works with the others), there is still either a tiny space
between the menu items or they overlap. And the mess I had to create in my
CSS does not look very elegant either.

- OP (tested with OP6) overlaps "Subitem One" and "Second Item". Strangely,
if I set a background color for #submenu, the overlapping is reduced, but
still there.

Any ideas?

Jul 20 '05 #6
Tim
On Sun, 11 Jan 2004 23:54:19 +0100,
"Thomas Mlynarczyk" <bl************ *@hotmail.com> wrote:
I noticed that IE seems to put some kind of default margins on <li> elements
and the only way to get rid of them seems to be assigning negative margins.
To make things worse, IE5 and IE6 seem to have different defaults. Is there
an elegant way to remove these stupid margins?


Different browsers have different defaults (margins and/or padding), if
you want to make anything customised, you're best to adjust all the
parameters that might be needed (set margins and paddings, as suits your
needs; which may also mean setting them on adjacent elements). That
way, you're not leaving things to chance, and you're not playing with
kludges to suit particular browsers.

--
My "from" address is totally fake. The reply-to address is real, but
may be only temporary. Reply to usenet postings in the same place as
you read the message you're replying to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #7
Also sprach Tim:
Different browsers have different defaults (margins and/or padding),
if you want to make anything customised, you're best to adjust all the
parameters that might be needed (set margins and paddings, as suits
your needs; which may also mean setting them on adjacent elements).
That way, you're not leaving things to chance, and you're not playing
with kludges to suit particular browsers.


I think I have done all that - please have a look at:
http://www.mlynarczyk-webdesign.de/menulist/
But still, without this extremely ugly "workaround " (commented in the style
sheet), IE will leave that space between the menu items which seems to be
due to the fact that IE makes li elements higher than necessary for the
contents. And I still don't understand why Opera overlaps the submenu with
its heading main menu item.

Jul 20 '05 #8
Anne van Kesteren wrote:
Spartanicus wrote:
Thomas Mlynarczyk wrote:
I noticed that IE seems to put some kind of default margins on
<li> elements and the only way to get rid of them seems to be
asigning negative margins. To make things worse, IE5 and IE6
seem to have different defaults. Is there an elegant way to
remove these stupid margins?


http://www.alistapart.com/articles/taminglists/


In short: applying a 'border-bottom' *or* removing all the spaces
between the elements.


That's unlikely to make any difference. Assigning incorrect widths to
IE/Win, and then correcting them for conforming browsers via a child
selector, is probably more useful advice. The link provided by
Spartanicus gives the gory details.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #9
Brian wrote:
In short: applying a 'border-bottom' *or* removing all the spaces
between the elements.

That's unlikely to make any difference. Assigning incorrect widths to
IE/Win, and then correcting them for conforming browsers via a child
selector, is probably more useful advice. The link provided by
Spartanicus gives the gory details.


I think you are reffering to "remove all spaces", like:

"<li>...</li><li>...</li>"

It works and has been tested.
--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3721
by: Frances Del Rio | last post by:
when I test my stuff with the validator in HomeSite it tells me the body tag no longer reads margin attributes.. does this mean now margins are to be specified only in CSS? I work for an internet co., they support IE 5+ and the old pre-6 Netscape.. if you don't put this tag in html docs, what version of HTML does it default to?...
8
4399
by: Jukka K. Korpela | last post by:
I just noticed that most browsers render <table border="1"><tr><td><p>foo</p></td></tr></table> the same way as <table border="1"><tr><td>foo</td></tr></table> That is, they ignore the p markup in the sense that they don't apply the normal default top and bottom margins. This is rather odd, especially
12
2445
by: Secret Guy | last post by:
I'm trying to understand generally how to make a grid of variously sized boxes using CSS. The first idea I had was to make a box where I can see the margin, padding, border and content edges, and understand why they have the areas that they do. And I'm having trouble... I read in the 2.1 spec, that the height and width properties specify the...
2
3108
by: Jeff Thies | last post by:
I have something like this: <span>a</span><span style="margin-left: 15px">b</span> It appears to me that horizontal margins are allowed for inline elements. (broken on preceding element right margin also) http://www.w3.org/TR/CSS21/box.html#q11 section 8.6 Is that right?
3
1754
by: fleemo17 | last post by:
The same layout I discussed earlier (http://www.sunriveronline.org/misc/clrn ) looks pretty darn good in most of the browsers I've checked it with, except for Opera. Apparently, Opera is applying my 0 Margin attribute on the background image, but keeping an 8-pixel margin for the page's elements, which throws the design into a tizzy. Is...
6
1471
by: namenotgivenhere | last post by:
Will the following css have the same visual result in most modern browsers as it does in IE6? TIA p { margin-top: 6px; margin-bottom: 6px} ul { margin-top: 6px; margin-bottom: 6px}
3
2923
by: Patient Guy | last post by:
For a long time, this page has been up and an embarrassment. http://tinyurl.com/ylcqum In Firefox, the table moves out of its parent container with the negative margin, but not in MSIE6. Does someone keep a list of workarounds in dealing with problems like these for the browsers that when listed in ranking order with respect to use,...
11
2207
by: listerofsmeg01 | last post by:
Argh! I'm going nuts trying to get a constant margin after a floated div that works cross browser. This works in IE but not Firefox: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head></head> <body> <div style="float:left; height:100px; background-color:red;">Hi, I'm floating</div>
6
2267
by: Paul Wake | last post by:
Do paragraph bottom margins overrule body margins? (To explain what I mean, http://www.xmission.com/~wake/computerrules.html has 5% margins, including the bottom margin, in IE, but not in Firefox. I assume Firefox does it correctly. Does this no-5%-bottom-margin happen because I have a specific paragraph bottom margin listed in the...
0
7612
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...
0
7924
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. ...
0
8120
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...
0
7968
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
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...
0
3653
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
1
1212
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.