Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 405
  • Last Modified:

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

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
arantius
Asked:
arantius
1 Solution
 
seanpowellCommented:
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
 
arantiusAuthor Commented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now