Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / HTML - Window Dimensions and Text Position HELP!

Author
Message
That C++ Nerd
19
Years of Service
User Offline
Joined: 30th Dec 2006
Location:
Posted: 7th Oct 2009 23:55 Edited at: 29th Aug 2010 19:20
 

Your signature has been erased by a mod because it's too big--- 300k!?
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 8th Oct 2009 00:44
I'm not quite sure if it's what you're after, but you can set positions to percentages of the surrounding container's dimensions (which might be the full page, or a table, div, etc.).

For example <image width = "50%" ...>.

dab
21
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 8th Oct 2009 03:24
You could do something like:

<div id="mainContainerDiv" style="width: 400px; margin-left: auto; margin-right: auto; background-color: #FF0000;">
This is centered text!!
</div>


The margin-left,-righ: auto should do the trick. Assuming of course this is what you want. Remember you have to set the width for this to work, especially with div's.

That C++ Nerd
19
Years of Service
User Offline
Joined: 30th Dec 2006
Location:
Posted: 8th Oct 2009 03:41 Edited at: 29th Aug 2010 19:21
  

Your signature has been erased by a mod because it's too big--- 300k!?
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Oct 2009 07:01
If I recall correctly, absolute positioning is relative to the container the element is in. But I might be wrong.

dab
21
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 8th Oct 2009 08:39 Edited at: 8th Oct 2009 08:41
Phaelax: I'm pretty sure absolute is from 0,0 at the top left of the view port (page). Relative position is 0,0 of its container.

And That C++ Nerd: here is a very rough example. I simply re-made the Twitter page you showed. Maybe something useful will come from it. If you need me to explain anything just let me know

http://www.dabberz.com/examples/example1-2009-10-7/

That C++ Nerd
19
Years of Service
User Offline
Joined: 30th Dec 2006
Location:
Posted: 9th Oct 2009 03:45 Edited at: 29th Aug 2010 19:21
   

Your signature has been erased by a mod because it's too big--- 300k!?
dab
21
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 9th Oct 2009 05:26
Sure thing!



BiggAdd
Retired Moderator
21
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 22nd Oct 2009 10:36
Quote: "Phaelax: I'm pretty sure absolute is from 0,0 at the top left of the view port (page). Relative position is 0,0 of its container."


Actually Phaelax is right. Positioning is always relative to its container (If the container has position: relative specified).

Run this:


Fixed positioning is always to the browser 0,0

Login to post a reply

Server time is: 2026-06-10 09:33:57
Your offset time is: 2026-06-10 09:33:57