Solved

Cross-browser-ness -- or, I hate IE

Posted on 2004-08-19
2
376 Views
Last Modified: 2008-03-17
Having difficulty getting a page I'm working on to display correctly in IE.  Works perfectly in Firefox, barely close in IE.

It's supposed to have a bar across the bottom of the window, a small div that looks like a button, and a menu popping up from the button on mouseover.  A number of other buttons are lined up to the right of the menu button.  Yes, it strongly resembles a taskbar.  As I said, everything functions exactly as I desire in Firefox (I'm running 0.9.3) so run that if you would like to know how I'm looking for it to show up.

In IE, the styles seem to largely be ignored for the button and <ul> that makes the menu.  It seems the "a#gufButton ul" rule is completely ignored by IE.
I have used an <a> as the element to render my button, because if I remember correctly IE only supports :hover on <a> tags.  If it can be just a div, that would be superb.

Code is at: http://www.arantius.com/ee/guffaw2.html as well as the two .css files referred to in it.
0
Comment
Question by:arantius
2 Comments
 
LVL 31

Accepted Solution

by:
seanpowell earned 250 total points
ID: 11849266
Well you made me work for that one :-)
Since the code you had was actually a little illegal (in terms of nesting a block level element inside an inline one) we need to change the <a> tag to a <div>.

With a few lines of javascript, we can indeed get IE to honer the hover on the li tag as well.

I apologize, I had to combine your 2 stylesheets so I could keep track of what was going on...


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<script type="text/javascript">
<!--

function sfHover()
{
      var sfEls = document.getElementById("gufButton").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"), "");
            }
      }
}

//-->

</script>


<style type="text/css">

html, body
{
      color: white;
      background-color: #8197B3;
      overflow: hidden;
      font-family: Tahoma, Verdana, sans-serif;
      z-index: 1;
}

a
{
      text-decoration: none;
}

div#runner
{
      background-color: #4A5767;
      border-top: 2px solid #1A2737;
      position: absolute;
      width: 100%;
      bottom: 0;
      left: 0;
      height: 29px;
      z-index: 500;
}

.button
{
      border: 2px outset;
      cursor:default;
      padding: 1px 2px;
      background-color: #7A8797;
      float: left;
      position: relative;
      top: 2px;
      left: 3px;
      width: 61px;
      height: 18px;
      color: white;
      font-style: normal;
      z-index: 10;
}

ul#gufButton, ul#gufButton li ul
{
      padding: 0;
      margin: 0;
      list-style: none;
}

ul#gufButton li.button
{
      font-style: italic;
      border: 2px outset #1A2737;
}

ul#gufButton li ul
{
      position: absolute;
      bottom: 20px;
      left: -999em;
      width: 150px;
}

ul#gufButton li ul li a
{
      font-style: normal;
      color: green;
      display: block;
      padding-left: 5px;
      padding-bottom: 2px;
      width: 145px;
}
      
ul#gufButton li.button:hover
{
      border: 2px inset #1A2737;
}

ul#gufButton li:hover ul, ul#gufButton li.sfhover ul
{
      left:-2px;
      background-color: #4A5767;
      padding: 3px 0px 3px 0px;
      border: 2px solid #1A2737;
}

ul#gufButton li:hover ul li a:hover, ul#gufButton li.sfhover ul li a:hover
{
      cursor:default;
      color: #660000;
      background-color: #7A8797;
}

#gufTray
{
      overflow: auto;
      padding: 4px;
      height: 20px;
}

#gufTray .button
{
      float: left;
      display: block;
      width: 15%;
      height: 18px;
      position: relative;
      top: -2px;
      margin-left: 4px;
}

</style>
</head>
<body onload="sfHover();" id="gufDesk">

<div id="gufDebug"></div>

<div id="runner">

      <ul id="gufButton">
            <li class="button"><strong>Guf</strong>faw
            <ul>
                  <li><a href="#" onclick="javascript:_gufStartApp('gufHello');">gufHello</a></li>
                  <li><a href="#" onclick="javascript:_gufStartApp('gufCalc');">gufCalc</a></li>
            </ul></li>
      </ul>

      <div id="gufTray">
            <div class="button">Test</div>
            <div class="button">Test</div>
            <div class="button">Test</div>
      </div>

</div>

</body>
</html>

Thanks,
Sean
0
 
LVL 18

Author Comment

by:arantius
ID: 11852141
Well, it works thanks sean!  I was hoping to avoid cluttering everything up with javascript (even though the rest of the site is chock full with it) but, thus is the price of cross browser compatibility.
Now to decipher all your code.  Thanks =)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question