Solved

IE4 and <DIV>

Posted on 2000-05-02
9
178 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Dynamically changing javascript code 2 44
Paper tearing animation 6 43
Image decoding from Camera 3 48
Modify Table Width 6 14
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…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now