HighDots Forums  

Screen Overrun

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Screen Overrun in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Richard
 
Posts: n/a

Default Screen Overrun - 12-20-2003 , 11:15 AM






Hi guys...

I have a centered div using the 50% and 1/2-dimensions negative margin
thing, but when the screen is shrunk, the div goes off the screen beyond
what the scroll bars can compensate for. Apparently there is some sort of
"body>#div" margin trick that margins the div in question flush with the
screen, but I have yet to implement it successfully.
Any tips or tricks? Should I be enclosing the div in another one, the height
& width of 100%?
http://members.rogers.com/rmacinty2/rohcg/as.htm



Reply With Quote
  #2  
Old   
Carl Durbridge
 
Posts: n/a

Default Re: Screen Overrun - 12-20-2003 , 11:57 AM







"Richard" <some (AT) where (DOT) com> wrote

Quote:
Hi guys...

I have a centered div using the 50% and 1/2-dimensions negative margin
thing, but when the screen is shrunk, the div goes off the screen beyond
what the scroll bars can compensate for. Apparently there is some sort of
"body>#div" margin trick that margins the div in question flush with the
screen, but I have yet to implement it successfully.
Any tips or tricks? Should I be enclosing the div in another one, the
height
& width of 100%?
http://members.rogers.com/rmacinty2/rohcg/as.htm


Hi Richard,
Not quite sure what yo are trying to achieve with negative margins and
absolute positioning here.
I'm not good at explaining things but here goes:
In #main
replace position:absolute with position: relative.
delete left:50% & top:50%;
replace margin-left:-320px; & margin-top:-240px; with margin:50px auto;
And delete body>#main { margin-left:-320px; margin-top:-240px;}

so you have

position:relative;
width:640px;
height:480px;
margin:50px auto;
padding:0px;
border:2px solid black;
background-color:transparent;
text-align:center;
z-index:2;

Seems to work





Reply With Quote
  #3  
Old   
Richard
 
Posts: n/a

Default Re: Screen Overrun - 12-20-2003 , 09:18 PM




"Carl Durbridge"
Quote:
"Richard"
Hi guys...

I have a centered div using the 50% and 1/2-dimensions negative margin
thing, but when the screen is shrunk, the div goes off the screen beyond
what the scroll bars can compensate for. Apparently there is some sort
of
"body>#div" margin trick that margins the div in question flush with the
screen, but I have yet to implement it successfully.
Any tips or tricks? Should I be enclosing the div in another one, the
height
& width of 100%?
http://members.rogers.com/rmacinty2/rohcg/as.htm


Hi Richard,
Not quite sure what yo are trying to achieve with negative margins and
absolute positioning here.
I'm not good at explaining things but here goes:
In #main
replace position:absolute with position: relative.
delete left:50% & top:50%;
replace margin-left:-320px; & margin-top:-240px; with margin:50px auto;
And delete body>#main { margin-left:-320px; margin-top:-240px;}

so you have

position:relative;
width:640px;
height:480px;
margin:50px auto;
padding:0px;
border:2px solid black;
background-color:transparent;
text-align:center;
z-index:2;

Seems to work
Thanks, but it only works with regard to centering the div relative to left
and right. I am also looking for centering relative to top and bottom, where
the div is perfectly centered in the middle of the screen.




Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.