Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-19
2
Medium Priority
?
402 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 31

Accepted Solution

by:
seanpowell earned 1000 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

715 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