Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Box Locations 6 20
CSS issue in Nested Master Pages 9 26
Pure CSS popout image menu - want the most beautiful style. 7 52
Add shadow behind div 5 25
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

840 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