PDA

View Full Version : Firefox/Safari OK but IE CSS errors....doctype?


pavinder
07-05-2006, 05:51 AM
Having trawled through page after page of similar threads and found no solutions, I wonder if some CSS guru might be able to offer any suggestion of where to start.

The pages on a site I'm building display fine in Firefox and Safari but not in IE. No text content appears at all (neither menu text nor page text) and the menu backgrounds are misplaced.

Validating the HTML leads to a few form errors which I haven't yet fixed, and a few inexplicable "The mentioned element is not allowed to appear in the context in which you've placed it" errors, yet these don't cause problems in FF and Safari.

Example page is at:
http://www.theshamanskitchen.com/perspect.sustain.php
(this page almost fully validated except for the above, but other pages not yet validated).

viewable copy of the page is at:
http://www.theshamanskitchen.com/perspect.sustain.htm

I wonder if it is possible that the doctype is the whole issue here? Before I manually replace ">" with " />" throughout and add alt tags etc, or add IE hacks, would a different doctype perhaps solve this?

I've read the sticky about doctypes but I'm not so tech-savvy to fully understand.

And if it ain't a doctype issue, then any guidance towards why the page may be failing would be gratefully appreciated.

Thanks in advance...

_Aerospace_Eng_
07-05-2006, 06:06 AM
Well in XHTML all attributes and tags need to be lowercase. When using a strict doctype the name attribute no longer exists. You also can't put block level elements inside of inline elements. Your form (block level) is in a span (inline). This validates.
<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="endlessness" />
<meta name="Keywords" content="shaman" />
<meta name="Description" content="A shamans kitchen thing." />
<meta name="robots" content="all" />
<title>Cooking With Love - Healing Through Food - The Shaman's Kitchen</title>
<link rel="stylesheet" href="styles/sk.css" type="text/css" />
<link rel="stylesheet" href="styles/menus.css" type="text/css" />
<link rel="Shortcut Icon" type="image/x-icon" href="styles/shaman.ico" />
<link rel="stylesheet" href="styles/scroll/jsscroll.css" type="text/css" />
<script type="text/javascript" src="styles/scroll/jsscrolldefs.js"></script>
<script type="text/javascript" src="styles/scroll/jsScroller.js"></script>
<script type="text/javascript" src="styles/scroll/jsScrollbar.js"></script>
<script type="text/javascript" src="styles/scroll/jsScrollerTween.js"></script>
<!-- the following script is related to the sfmenus and is an IE hack -->
<script type="text/javascript"><!--//--><![CDATA[//><!--

sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]></script>
</head>
<!-- Here we go... -->
<body>
<div id="shamanbody" style="background: url(styles/images/bg06.jpg) no-repeat top left;">
<div id="header"> <span class="bannerbox"><img src="styles/images/black.gif" width="0" alt="bg" /></span>
<div id="loginform"> <span class="loginformbox"><img src="styles/images/white.gif" width="360" alt="bg" /></span>
<div id="loginformcontent">
<form action="" method="post" name="logform" id="logform" onsubmit="checkdtls();return false;">
<span class="loginformtext"> &nbsp;&nbsp;Member login:&nbsp;
<input type="text" name="iusername" size="13" maxlength="12" value="username" />
<input type="password" name="ipassword" size="13" maxlength="12" value="password" />
<a href="#" onclick="checkdtls();">&nbsp;&nbsp;enter&nbsp;</a> </span>
</form>
</div>
</div>
</div>
<div id="main">
<div id="menus">
<div id="mainmenu"> <span class="mainmenubox"><img src="styles/images/black.gif" width="300" alt="bg" /></span>
<div id="mainmenucontent"><br />
<ul id="nav" class="mainmenutext">
<li><a href="bg.creating.php">BACKGROUND</a>
<ul>
<li>Philosophy And History Of The Shaman's Kitchen</li>
</ul>
</li>
<li><a href="tips.cheftips.php">FOOD TIPS</a>
<ul>
<li>Tips From The Shaman Chef</li>
</ul>
</li>
<li><a href="recipes.break.php">RECIPES</a>
<ul>
<li>Easy, Healthy, Delicious Food Ideas</li>
</ul>
</li>
<li><a href="hemp.benefits.php">HEMP</a>
<ul>
<li>Nutritionally And Environmentally The Missing Link</li>
</ul>
</li>
<li><a href="news.vision.php">NEWS</a>
<ul>
<li>What's Going On Now, What's Coming Up Soon</li>
</ul>
</li>
<li><a href="perspect.sustain.php">PERSPECTIVES</a>
<ul>
<li>Thoughts For A More Sustainable World</li>
</ul>
</li>
<li><a href="subscribe.benefits.php">SUBSCRIBE</a>
<ul>
<li>How To Contact Us And Join The Shaman's Kitchen Community</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="submenu"> <span class="submenubox"><img src="styles/images/black.gif" width="300" alt="bg" /></span>
<div id="submenucontent"> <span class="submenutext"> PERSPECTIVES<br />
<a href="perspect.sustain.php">Sustainable Living</a><br />
<a href="perspect.links.php">Links</a><br />
</span> </div>
</div>
</div>
<!-- menus -->
<div id="contentarea"> <span class="contentbox"><img src="styles/images/white.gif" width="1100" alt="bg" /></span>
<div id="content">
<div id="Container" class="contentnormal">
<div id="thescrollcontent">
<div class="Scroller-Container">
<h2><span class="headingbox">Sustainable living</span></h2>
<p></p>
<p> To live a sustainable life is to leave as light a footprint on the earth as is possible.
It is being aware of our responsibility, as the inhabitants of this most magnificent planet to care for her!</p>
<p> Our society 'mostly' Produces, Consumes and Wastes, it is a straight line to the extinction of the human race! <br />
On the other hand, Nature and the Earth have their circles or cycles; we are therefore living out the flow or circle of life.<br />
A sustainable community is one where there is no waste~ every thing is re-cycled. Bringing us in- cycle with Earth and Nature.</p>
<p> In order to change our world we have to start with individual responsibility. By taking care of our own environment we set the tone for changing the larger perspective.</p>
<p> To care for our own environment is being aware of the waste we create, then to seek ways to lessen the impact we have, particularly land fill waste. This requires a complete change in thinking. </p>
<p> The Kitchen can and perhaps is the best place to help us create our own wholesome cycles; for our own bodies and then using it as the place to recycle, so setting the tone of caring for the planet. </p>
<p> Just for a day!<br />
Take the time to see how much water we flush down the sink. <br />
Notice how much plastic packaging you bring home from the super market, even better try to buy things that are not!</p>
<p> It is essential that we take the time individually to address these issues, for time is running out for our very survival, if we do not 'take the time' very soon!</p>
<p> My mission at Green and Away this year is to find as many ways as possible to Re-use and Re-cycle, I look forward to offering the finings in the autumn edition of The Shaman's Kitchen. Subscribe </p>
</div>
</div>
</div>
<div id="Scrollbar-Container">
<div class="Scrollbar-Up"></div>
<div class="Scrollbar-Down"></div>
<div class="Scrollbar-Track">
<div class="Scrollbar-Handle"></div>
</div>
</div>
</div>
<!-- content -->
</div>
<!-- contentarea -->
</div>
<!-- main -->
<div id="footer"> <span class="footertext">design&nbsp;&nbsp;: <a href="#">&nbsp;&nbsp;endlessness.org&nbsp;&nbsp;</a></span> </div>
</div>
<!-- shamanbody -->
<!-- These extra divs/spans may be used as catch-alls to add extra imagery. -->
<div id="extraDiv1"><span></span></div>
</body>
</html>

Your problem seems to be because of z-indexing. I see you used absolute positioning in your CSS. It seems that you may have gone overboard with it which is the likely cause of your problem.

pavinder
07-05-2006, 11:41 AM
Thanks so much.....such a quick reply....most appreciated.

I'll compare your code to what I had, and hopefully be OK from here. Didn't think I'd gone overboard with z-indexing or absolute positioning, but will take a good hard look.

pavinder
07-05-2006, 02:11 PM
Well, took a good hard look, and the new code validates perfectly yet still has exactly the same problem in IE - no text displaying at all.

Absolute positioning and z-indices are valid CSS code so I cannot see why this is happening. I feel kind of back where I started yesterday, with perhaps even more confusion as now I know that doctypes and validation are nothing to do with the IE problem.

Any advice would be most appreciated if anyone has any ideas - what starting point to try solving such an issue?

Thanks again in advance for any help.

_Aerospace_Eng_
07-05-2006, 08:29 PM
I never changed anything. I was just validating your code. My advice is to not use absolute positioning if you don't have to. Yeah they are valid but it is likely the cause of your problem. When it comes to z-indexes IE reads them differently.

pavinder
07-06-2006, 04:51 AM
I need to use absolute positioning as far as I can see - I have different menus which must line up underneath each other a fixed distance from the top of their containing div which itself must stay in position.

If I try to change this to other types of positioning then things go out of whack in Firefox too. Have tried various combinations but nothing seems to work.

I have read many articles describing how it is a good idea to contain absolutely positioned elements within a relatively positioned div, but I can't see an alternative to absolute divs in this case. I accept there is always another way to do things, but the way I am using seems both the simplest and most intuitive - a div for the menus, individual divs inside this for different menu elements.

Any good articles anybody could refer me to which might show an example of absolute divs that don't work in IE and then a generic solution that does work for IE?

Thanks...