Forum Moderators: not2easy

Message Too Old, No Replies

ul background problem with Mozilla

         

secureitall

1:31 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



Hi,

I have created a list with background color by using the following code. My problem is that it shows up properly in IE but not Mozilla.

In IE, the background color displays in the center of the page with white space margin on the left and right; however, with Mozilla, the background color goes all the way to left and right side of the page ( the background color table is extend way further to the left and right than IE)

Can anyone show me how to solve this problem? Thanks in advance

CSS code


#list ul{
width:540px;
background:#eee;
border: 1px solid #eee;}


#list ul li{
color: #333333;
list-style: inside;
font-family: tahoma; font-weight: strong; font-size: small; text-align:left;
line-height:17px;}

HTML code


<p> text text..............
<div id="list">
<ul>
<li>1 - item 1 </li>
<li>1 - item 2 </li>
<li>1 - item 3 </li>
<li>1 - item 4 </li>
</ul>
</div>
</p>

Nick_W

1:39 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm..

A little difficult to grasp what you mean but I just tested it in Moz and that's exactly how I'd expect it to work.

Do you mean you want the grey color to start right on the actual bullets not 1 1/2 inches to the left of them?

Nick

[edited by: Nick_W at 1:42 pm (utc) on June 18, 2003]

BlobFisk

1:42 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi secureitall,

I've just had a look at this and am unable to recreate the problem. The only thing that appears a little different is that the left-margin is greater in mozilla 1.0 than it is in Opera7.11 or IE6.

It looks to me like both IE and Moz are adhering to the width... Do you have some style code for the #list?

mipapage

1:45 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This appears the same in the two browsers that you mention:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
ul#list{
width:540px;
background:#eee;
border: 1px solid #eee;
padding:0
}

ul#list li{
color: #333333;
list-style: inside;
font-family: tahoma; font-weight: strong; font-size: small; text-align:left;
line-height:17px;}

-->
</style>
</head>

<body>
<p> text text..............

<ul id="list">
<li>1 - item 1 </li>
<li>1 - item 2 </li>
<li>1 - item 3 </li>
<li>1 - item 4 </li>
</ul>
</p>

</body>
</html>

Seems Moz adds padding to the list, so 'padding:0'.

I also changed things a bit, which results in less code. Since you are using an id for the list, you're only using it once, no need to make it a div, just apply it to the ul.

[edited by: mipapage at 1:46 pm (utc) on June 18, 2003]

BlobFisk

1:46 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I have a solution for you:

Add padding: 0px; (or whatever suits) to #list ul

This should make everything look the same way.

HTH

secureitall

1:55 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



Thank you all very much :)

I tried the fix mipapage and BlobFisk suggested. After adding the

 padding:0; 
the width of grey table is fixed but the position of whole list table are still different. IE is about 100px further right compare to Mozilla. Any suggestions?

Thanks

mipapage

1:57 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm.. you may have to post more of your code, 'cause the code that I posted looks identicle in Moz and IE6 over here...

BlobFisk

1:59 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, I can confirm that - things look identical on both IE6 and Moz 1.0

Have you got some styling associated with the #list div that might be affecting this on your end?

Also, do you have the correct doctype decleration?

Nick_W

2:01 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You keep mentionig a table, I can't help but think that may be playing a part here?

Nick

secureitall

2:10 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



hmm.. now it really puzzle me. I copy mipapage codes above and view in IE 6 and Moz 1.6. The whole position of list table is align to the left of the screen in Moz 1.6 but with IE 6 it is about 100px to the rigth.

IE 6 looks like


text text .............
____________________
¦
¦
¦____________________

Moz 1.6 looks like


text text .............
____________________
¦
¦
¦____________________

Nick_W

2:12 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It just sounds like the difference in how UA's handle lists to me. Some add more padding than others. It's not a precise medium.

Or have I missed the point?

Nick

secureitall

2:12 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



sorry if I used the wrong word Nick_W. There is no table involve in this case :) thanks

grahamstewart

2:15 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



IE is about 100px further right compare to Mozilla. Any suggestions?

Try setting margin:0 on the list as well.

I think IE uses margins to indent lists and moz uses padding.

mipapage

2:16 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It just sounds like the difference in how UA's handle lists to me. Some add more padding than others. It's not a precise medium.

Not sure about that one, Nick. I see exactly the same thing in IE6 as I do in Moz.

securitall, what IE are you using?


I haven't been in a thread that moves this fast outside of forum3 in a while!

Nick_W

2:17 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, I bow to your greater knowledge mipapage, I have no version of IE handly. I'm just guessing ;)

Nick

secureitall

2:19 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



Yes problem solve! I used grahamstewart
 margin:0;
and now it looks the same in both browser.

Thank all sooo much for helping newbie like me. I really appreciate all the helps and suggestions.

Thank you.

Nick_W

2:21 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, stick around secureitall, this is what happens here and it's how we all learn. Give it a month and you'll be a CSS wizz! ;)

Nick

secureitall

2:21 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



hi mipapage,

I am using version 6 (or version 6.0.2800.1106).

mipapage

2:24 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmph. That's a stumper.

Well, glad that you got it solved!

drbrain

8:25 pm on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you ever need to know what mozilla is doing by default with a particular element, these links will tell you exactly what you need to know:

[lxr.mozilla.org...]
[lxr.mozilla.org...]