Solved

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

Posted on 2004-08-19
2
366 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Menu Inconsistent 3 32
CSS Divs in Safari 3 39
FIx alignment of two texts 1 26
Why is this panel heading creating extra space 2 33
Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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…

919 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now