Solved

IE4 and <DIV>

Posted on 2000-05-02
9
187 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Form with Modals 16 55
html input type 3 32
Joomla 2.5 shopping cart 7 23
CSS: How do I override in-line styling 11 15
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

770 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