Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Centred Page - Pixel Jog

Centred Page - Pixel Jog
Thread Tools
Phil Sherry
Dedicated MacNNer
Join Date: Nov 2004
Location: Stockholm, Sweden
Status: Offline
Reply With Quote
Jun 1, 2005, 06:43 AM
 
Something which drives me batty is the way browsers handle centering a site. If it doesn't scroll, it's in one "centre," yet it jogs over a few pixels when the page scrolls. What's that all about? Why does it seem to have two centres?

Not sure what I'm on about? Check these pages: Example 1 & Example 2

I want answers.
     
Peder Rice
Mac Enthusiast
Join Date: Jan 2002
Status: Offline
Reply With Quote
Jun 1, 2005, 08:48 AM
 
Well, I don't know why they have persisted. I code a great deal of web applications, and I often have Javascript events that expand/contract the page. When the page grows, it often throws things a little off, since it's now the new center alignment.

I understand why it performs as it does (it's just a window filling all of its space), but I would imagine that a persistent scroll bar would alleviate this problem.
     
piot
Forum Regular
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jun 1, 2005, 09:02 AM
 
A web page that requires vertical scrolling adds a scroll bar to the right hand side...... which shifts all the content to the left!

NOTE. Your two examples both require a scrollbar on screens of 1024 x 768 or below. Currently, that's about 80% of web traffic.
Piot
     
Phil Sherry  (op)
Dedicated MacNNer
Join Date: Nov 2004
Location: Stockholm, Sweden
Status: Offline
Reply With Quote
Jun 1, 2005, 09:10 AM
 
Originally Posted by piot
A web page that requires vertical scrolling adds a scroll bar to the right hand side...... which shifts all the content to the left!
Yes, but the content isn't shifted over by the same pixel width as the scroll bar. If it was, I wouldn't be moaning about it, because I could handle that. It's just a few pixels, not about 15-20px, which is what yer average scroll bar weighs in at.

I still want answers.
     
bwahahax
Forum Regular
Join Date: Apr 2003
Location: Toronto, Canada
Status: Offline
Reply With Quote
Jun 1, 2005, 09:18 AM
 
Because the content is centred it won't move over to the left the entire width of the scrollbar, only half of the width. The browser removes half of the scrollbar's width from the padding on the left of the content, and half of the scrollbar's width from the padding on the right.

With a screen ruler I can see that the padding is reduced by 8px on either side, for a total reduction of 16px, which, on my system, is the exact width of the scrollbar. Other OS's might have different scrollbar widths, so the padding reduction may vary slightly.
( Last edited by bwahahax; Jun 1, 2005 at 09:27 AM. )
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Jun 1, 2005, 09:24 AM
 
When you say 'few pixels' do you mean roughly 8? The scroll bars in OS X are 16px wide, I think, so it would make the centring shift by half the offset, no?

Edit:
Beaten to the post! That's what I get for going and watching telly before finally posting my reply.
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Phil Sherry  (op)
Dedicated MacNNer
Join Date: Nov 2004
Location: Stockholm, Sweden
Status: Offline
Reply With Quote
Jun 1, 2005, 09:52 AM
 
Okay, I'll probably settle for that. And I'm not even watching tele (although, we do have two in the office).

It's still annoying, though.
     
piot
Forum Regular
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Jun 1, 2005, 10:53 AM
 
Hey Phil, only just noticed your sig. I'm not being tetchy here, but how come you had this very basic problem with web layout and yet you have actually written a whole book on web dev?
Piot
     
Phil Sherry  (op)
Dedicated MacNNer
Join Date: Nov 2004
Location: Stockholm, Sweden
Status: Offline
Reply With Quote
Jun 1, 2005, 03:06 PM
 
Originally Posted by piot
Hey Phil, only just noticed your sig. I'm not being tetchy here, but how come you had this very basic problem with web layout and yet you have actually written a whole book on web dev?
Because I posted the original question from work, where my brain is usually turned off.
     
   
Thread Tools
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 07:10 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,