html - Cross Browser Issue -
my background in winforms programming , i'm trying branch out bit. i'm finding cross-browser issues frustrating barrier in general, have specific 1 can't seem work through.
i want display image , place semi-transparent bar across top , bottom. isn't ultimate goal, of course, demonstrates problem i'm having in relatively short, self-contained, code fragment let's go it.
the sample code below displays intended in chrome, safari, , firefox. in ie8, bar @ bottom doesn't appear @ all. i've researched hours can't seem come solution.
i'm sure dumb rookie mistake, 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>
you self-closing div
tag, not allowed self-closed.
you must close div
tag this: </div>
.
some browsers support stupid mistakes these, , attempt close tags you. ie, on other hand, doesn't.
try this:
<!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> <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> </div> </body> </html>
Comments
Post a Comment