Solved

IE4 and <DIV>

Posted on 2000-05-02
9
194 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
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

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

Suggested Solutions

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

830 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