Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-20-2002, 10:44 PM   PM User | #1
whatever
New to the CF scene

 
Join Date: Jul 2002
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
whatever is an unknown quantity at this point
Smile table position

is there a way to determine a table's position? I'm generating dynamic tables on top of layers using <div>, so i need to know the position of certain tables relative to the browser window. Like if its possible to find how many pixels the table is from the left and top edges of the browser.

Thanks!
whatever is offline   Reply With Quote
Old 07-20-2002, 10:55 PM   PM User | #2
mouse
Regular Coder


 
Join Date: Jun 2002
Location: North East England
Posts: 853
Thanks: 0
Thanked 0 Times in 0 Posts
mouse is an unknown quantity at this point
You can determine the <div's position using absolute positioning like so...

<style>
div#bob{
position: absolute;
top:100px;
left100px
}
</style>

<div ID="bob">content</div>


OR

<div style="position:absolute;top:100px;left:100px">content<div>

Either giving the same result; a layer 100 pixels from both top and left. The first would enable you to define the co-ordinates through an external *.css file or through styling in the headers.
__________________
[+] Computer/PC issues [+] Silverpaw3D
------------------------------------------------
Never buy a dwarf with learning disabilities...

...it's not big, and it's not clever.
mouse is offline   Reply With Quote
Old 07-21-2002, 05:15 PM   PM User | #3
Graeme Hackston
Regular Coder

 
Join Date: Jun 2002
Posts: 624
Thanks: 0
Thanked 0 Times in 0 Posts
Graeme Hackston is an unknown quantity at this point
http://msdn.microsoft.com/library/de.../measuring.asp
Graeme Hackston is offline   Reply With Quote
Old 07-21-2002, 05:26 PM   PM User | #4
Graeme Hackston
Regular Coder

 
Join Date: Jun 2002
Posts: 624
Thanks: 0
Thanked 0 Times in 0 Posts
Graeme Hackston is an unknown quantity at this point
This might give you a better idea

<html>
<head>
<title></title>
<script>
onload = function() {
var top = document.getElementById("table").offsetTop;
var left = document.getElementById("table").offsetLeft;
alert("left "+left+" px");
alert("top "+top+" px");
}
</script>
</head>
<body>
<table id="table" border="1">
<tr>
<td></td>
</tr>
</table>
</body>
</html>
Graeme Hackston is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:31 AM.


Advertisement
Log in to turn off these ads.