Solved

IE4 and <DIV>

Posted on 2000-05-02
9
200 Views
Last Modified: 2010-04-09
This will work in IE5.0:
<style>
      #leftbutton{
            position:absolute;
            right:16px;
            top:0px;      
      }
      #rightbutton{
            position:absolute;
            right:0px;
            top:0px;      
      }
</style>
..but it doesn't work in IE4.0. How can I produce the same layout (two images positioned on the top right) in IE4?
0
Comment
Question by:fwickes
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 3

Expert Comment

by:davlun20080
ID: 2772010
For CSS-P I believe you actually need to declare the top and left properties:
so the code would be:
<style>
#leftbutton{
position:absolute;
left:546px;
top:0px;
}
#rightbutton{
position:absolute;
left:560px;
top:0px;
}
</style>

If you need to place in the top right corner of the window, you will need to sniff the client width and position accordingly.  I don't have my reference here at home, took it to work, but if you need to figure out the height let me know and I will look it up.

davlun
0
 

Author Comment

by:fwickes
ID: 2772039
thanks davlun,
yes it would be helpful if you could help me with client height. The images have to remain in the top right when the window is resized as well.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2772202
how about instead of using div's using a table

<table width=100% border=0>
<tr>
  <td align=left>
     leftbutton here
  </td>
  <td align=right>
     rightbutton
  </td>
</table>

and place an additional topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 in your body-tag.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:davlun20080
ID: 2773470
fwickes,
CJ_S proposed a solution that is used by many for these kinds of layouts. You may wish to consider that since it is easier to work with than div's, but I will check the code on this later today when I get to work.

davlun
0
 

Author Comment

by:fwickes
ID: 2774878
thanks CJ_S, I will use tables as a very last resort as it will change the layout of the rest of the exisitng page.
0
 

Author Comment

by:fwickes
ID: 2776191
thanks CJ_S, I will use tables as a very last resort as it will change the layout of the rest of the exisitng page.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2776407
Or use:

..MyDiv {position:absolute;top:0px;left:0px;}

<div class=MyDIV>
<table width="javascript:return window.screen.availWidth" border=0>
<tr>
  <td align=left>
     leftbutton here
  </td>
  <td align=right>
     rightbutton
  </td>
</table>
</div>
0
 

Author Comment

by:fwickes
ID: 2776467
I tried that code and it aligns to the left, I need it to align the images to the top right
0
 
LVL 3

Accepted Solution

by:
davlun20080 earned 50 total points
ID: 2779173
Sorry for the delay in getting back on this one, the offsetWidth and offsetHeight will return the values for the browser area that is usable in IE.

Once you know the size you can script the position of the div that has been absolutely positioned with:

<script>
function repositionLayer(){
document.all.myDiv.style.posTop= document.body.offsetHeight - 100;
document.all.myDiv.style.posLeft = document.body.offsetWidth - (document.body.offsetWidth-10);
document.all.style.visibility="visible"
}
</script>
<body onLoad="repostionLayer()">

What I do is make the initial state of the layer hidden, then onLoad, reset the position of the layer dynamically and make it visibile.  The final result is a div that appears to be the last thing to load.

davlun
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

739 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