Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I'd like to design a page that is centered but the onbjects within it are absolute. In other words the page width has an absolute size and position that is the center, but the objects within the page are absolute as well.
I was thinking that a way to do it would be do desing the entire page within a single cell table and then center the table. The thing is that it would be best if I could use CSS within the table so as to have the ability to put each thing in an absolute position... Is this possible, and if so how?
Thanks,
Larry

If the position of all the elements is going to be absolute, then you wouldn't need a table. By stating an absolute value (i.e. distance from the top-left corner of the page) it won't matter if the elements are "within" in a table or not.
So, you must mean relative where you define the elements position relative to the top-left of the table. You shuld be able to do this. Check out this tutorial
Michael J

Thank you very much! From what you're saying it would seem that this method is basically like using tables except that the code is in CSS (in other words there is no advantage to using CSS if everything is going to be relative again...)
The question, I guess is like this: Can you use CSS inside of the table (or a DIV instead of a table) and use absolute positioning only inside. For example: a DIV that is centered but it contains other DIV's that are absolute- but only absolute relative to it (and it is centered...))
Thanks,
Larry

I lost you about 1/2 way through that 2nd paragraph. You should really find a few good tutorials and find out what CSS can and can't do.
As for absolute and relative, I don't think you get it. Absolute is just that. It is independant upon where the element is located. For example, if you have a table that is 200 pixels wide and you have an element inside the table with CSS properties such that it has an absolute horizontal position of 300, then that element will appear outside of the table. The fact that the code for that element is located within the table doesn't matter because it has an absolute horizontal position that is defined outside the table!
You can do just about everything you said you wanted to do with just CSS - no tables. I find that tables are more expedient for most of the work though. But, others feel differently...
Take a look at this page that only uses CSS: http://www.penname.co.uk/index.html
Michael J

Thanks. I'll look into it, but I guess to rephrase the question: when you design a page that is good for a 17 inch monitor and someone with a 21 inch views it, you can either have the page resize, go left, go right, OR you could place the entire page in a single cell table and then just center the table thus having a centered page...
Now being that I'm trying to use CSS now, I've bumped into this question: how would/could I achieve the same effect with a page done in CSS?
I'm going to look around more, but if anyone here might know of a simple answer to this (I'm sure many people have had this need?!) please let me know...
Thanks,
Larry

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |