473,395 Members | 1,639 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,395 software developers and data experts.

Correct in Opera & IE, but not in FireFox

Hi everybody,

I'm having problems with the following pieces of html & css (sorry, I
can't put them on a website here, so I had to post them).

Basically, it's a menu with some sub elements. In Opera and IE the menus
show correctly, but in FireFox the sub elements don't have any margin
below them.

Would anybody care to explain why? I'm at a loss here...

Thanks in advance!

Here is the code:

--- html code ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title></title>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#">Main 1</a></li>
<li><a href="#">Main 2</a></li>
<li id="sub"><a href="#">Sub 1</a></li>
<li id="sub"><a href="#">Sub 2</a></li>
<li id="sub"><a href="#">Sub 3</a></li>
<li><a href="#">Main 3</a></li>
<li><a href="#">Main 4</a></li>
<li><a href="#">Main 5</a></li>
</ul>
</div>
</body>
</html>

--- css ---
#menu
{
width: 150px;
margin: 0 0 10px 0;
padding: 0;
font-size: 0.9em;
}

#menu ul
{
list-style: none;
width: 150px;
margin: 0 0 20px 0;
padding: 0;
font-size: 1.1em;
}

#menu li
{
margin-bottom: 4px;
}

#menu li a
{
font-weight: bold;
height: 20px;
text-decoration: none;
color: #505050;
display: block;
padding: 6px 0 0 10px;
background: #f4f4f4;
}

#menu li a:hover
{
background: #eaeaea;
color: #286ea0;
}

#menu li#sub
{
font-weight: bold;
height: 20px;
text-decoration: none;
color: #505050;
display: block;
background: #f4f4f4;
margin-left: 10px;
}

Best regards,

Ikke
Apr 28 '06 #1
4 1313
Hi Ikke,

You can't have more than one of the same id. Change #sub from an id to
a class and see if that helps.

Adam

Apr 28 '06 #2
Ikke wrote:
Would anybody care to explain why? I'm at a loss here...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


Your Doctype triggers Quirks mode, and your markup (snipped) doesn't conform
to the DTD specified by your Doctype. Fixing those issues is usually the
first thing to try when dealing with inconsistency between browsers.

(Sometimes you might want to use Quirks mode, but not usually).

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Apr 28 '06 #3
David Dorward <do*****@yahoo.com> wrote in
news:e2*******************@news.demon.co.uk:
Ikke wrote:
Would anybody care to explain why? I'm at a loss here...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


Your Doctype triggers Quirks mode, and your markup (snipped) doesn't
conform to the DTD specified by your Doctype. Fixing those issues is
usually the first thing to try when dealing with inconsistency between
browsers.

(Sometimes you might want to use Quirks mode, but not usually).


First of all, thanks David and Adam for your replies. I have had a look at
the code, both html and css, and left out everything that could be a
problem.

I have also been able to put up an example on a website, so it's easier for
you to see what is the problem (instead of having to look at the code I
posted).

Anyway, I've spent several hours this week(end) trying to rewrite it (and
trying to understand where it goes wrong) and this is the result:

http://tesinfo.atspace.com/menu.html

As you can see, there is a problem in the submenus when you perform a hover
(a grey area remains on top). Also, the font in the submenus is not the
same as in the main menus.

Can anybody please point me in the right direction? Also, are there any
tutorials out there for CSS? Most of the ones I found are merely a summary
of what is possible and what not...

Thanks in advance,

Ikke
May 1 '06 #4
Ikke wrote:
I have also been able to put up an example on a website, so it's easier for
you to see what is the problem (instead of having to look at the code I
posted).

Anyway, I've spent several hours this week(end) trying to rewrite it (and
trying to understand where it goes wrong) and this is the result:
Validation appears to have problems reaching the page.
The only way I got a result was through the Firefox "HTML Validator"
extension (seems good).

The first meta tag is unclosed.
The subCats li tag has a spurious ".
I also got a CSS complaint about the value of the text-transform
property (bold) on line 59 of your css.

ie6 renders the same as firefox.
http://tesinfo.atspace.com/menu.html

As you can see, there is a problem in the submenus when you perform a hover
(a grey area remains on top). Also, the font in the submenus is not the
same as in the main menus.

Can anybody please point me in the right direction? Also, are there any
tutorials out there for CSS? Most of the ones I found are merely a summary
of what is possible and what not...


Never found anything good - some of the "professionals" offering
training materials publish untested rubbish that doesn't even work with
ie. Best is to bookmark the reference documents, and read around this
list - once you've grasped the ethos you're most of the way there.

Chris
May 2 '06 #5

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

Similar topics

6
by: Quintus Snapper | last post by:
Hi everyone. I'm just making new HTML pages for a site. This time round I've brushed up on my CSS and trying to use as much of it as possible and as well as trying to keep it W3C compliant. So...
3
by: Boris | last post by:
Please open http://www.highscore.de/opera/floatleft.html in Opera 7.54 and Firefox 1.0 Preview. Who is right? In my humble opinion Opera 7.54 is right: According to CSS 2.1 a "floating box must...
3
by: Howard Martin | last post by:
I have a page at www.caymanquays.com.au/index.html where the navigation at the top works fine in MSIEv6 and Opera v7.5 but appears dead in Mozilla v1.5 and Firefox v1.0. The external sylesheet...
11
by: Hymer | last post by:
Hello, I have a small table that works fine in IE6 but does not render at all in Opera or Firefox. Can anyone see what might be needed to get this to work in all three browsers? The code...
1
by: Grzegorz ¦lusarek | last post by:
Hi everyone. I'm looking for javascript tools for web browser like IE and OPERA. I want find something like javascript shell http://www.squarefree.com/shell/shell.html for IE and OPERA. Does anyone...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
15
by: Lennart | last post by:
Hi folks, I have created an animated image gallery in dhtml. It works fine in Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag. The page is valid xhtml-strict but with a...
7
by: Dr J R Stockton | last post by:
I've heard that at <URL:http://www.merlyn.demon.co.uk/js-clndr.htm#P> and using Opera the suffixed dates in the yellow box appear in a single long line instead of in the obvious weekly manner. ...
15
by: dhtml | last post by:
Title says it. If I use a for in loop on an HTML collection, I get length twice. <!DOCTYPE HTML> <html lang="en"> <head> <title>length twice</title> </head> <body> <form...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
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...

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.