Cross Browser Issue

Posted by dazedandconfused on Stack Overflow See other posts from Stack Overflow or by dazedandconfused
Published on 2010-04-28T01:22:16Z Indexed on 2010/04/28 1:23 UTC
Read the original article Hit count: 373

My background is in WinForms programming and I'm trying to branch out a bit. I'm finding cross-browser issues a frustrating barrier in general, but have a specific one that I just can't seem to work through.

I want to display an image and place a semi-transparent bar across the top and bottom. This isn't my ultimate goal, of course, but it demonstrates the problem I'm having ina a relatively short code fragment so let's go with it.

The sample code below displays as intended in Chrome, Safari, and Firefox. In IE8, the bar at the bottom doesn't appear at all. I've researched it for hours but just can't seem to come up with the solution.

I'm sure this is some dumb rookie mistake, but gotta start somewhere. Code snippet...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" language="javascript">
</script>
<style type="text/css">
    .workarea
    {
        position: relative;
        border: 1px solid black;
        background-color: #ccc;
        overflow: hidden;
        cursor: move;
        -moz-user-focus: normal;
        -moz-user-select: none;
        unselectable: on;
    }

    .semitransparent
    {
        filter: alpha(opacity=70);
        -moz-opacity: 0.7;
        -khtml-opacity: 0.7;
        opacity: 0.7;
        background-color: Gray;
    }
</style>
</head>
<body style="width: 800px; height: 600px;">
<div id="workArea" class="workarea" style="width: 800px; height: 350px;
    left: 100px; top: 50px; background-color: White; border: 1px solid black;">
    <img alt="" src="images/TestImage.jpg" style="left: 0px; top: 0px; border: none;
        z-index: 1;" />
    <div id="topBar" class="semitransparent" style="position: absolute;width: 800px;
        height: 75px; left: 0px; top: 0px; min-height: 75px; border: none; z-index: 2;" />
    <div id="bottomBar" class="semitransparent" style="position: absolute; width: 800px;
        height: 75px; left: 0px; top: 275px; min-height: 75px; border: none; z-index: 2;" />
</div>
</body>
</html>

© Stack Overflow or respective owner

Related posts about html

Related posts about cross-browser