Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

IE4 and <DIV>

Posted on 2000-05-02
9
Medium Priority
?
214 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
Industry Leaders: 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

688 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