Variable Screen Resolution Centring |
Variable Screen Resolution Centring |
Aug 25 2008, 02:20 AM
Post
#1
|
|
![]() i like boobies, yes I do. I like boobies - how 'bout you? ![]() ![]() ![]() ![]() ![]() Group: Member Posts: 620 Joined: Jun 2008 Member No: 662,457 |
I've seen a lot of layouts on CB that I like, but I'd like them a lot more if they were centred in my screen resolution (1280x800). It just looks funny to have a layout on the left of my screen when it's in the centre of a smaller resolution. I understand that those people are centring for 800x600, but it ain't that hard to centre it for all screen resolutions. Professional websites do it, loads of people on CB do it, hell even I do it when the layout calls for it (and I'm really lazy).
I dunno, I'm just whining about something I think every coder should know, I guess. It's 2am *lol*, what do you expect? Not that hard to centre things, really. Take a 400x200 image banner: CODE #class { position: absolute; left: 50%; margin-left: -200px; ... } Bam, it's in the centre of every screen. :] Putting something directly in the centre of a screen is easy, just set "left:;" to 50% and "margin-left:;" to exactly half of the width of whatever you're centring. You'd have to play around with the margin a bit more for things that are to the left or to the right of the centre line, but all you have to do is increase or decrease it depending on which side you want it to go to. Check for major browser compatibility (IE, Firefox, Opera...) and you're set! Enough sleepy ramblings, anyone out there agree or are ya'll sleeping?
Reason for edit: Use [code] not [codebox] for smaller codes. Thanks. :) - Gabi
|
|
|
|
![]() |
Aug 25 2008, 01:35 PM
Post
#2
|
|
|
Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Member Posts: 1,237 Joined: May 2008 Member No: 648,123 |
i was sleeping, but i'm with you 100% on this. it's not even just for centering layouts, though; it's the whole concept of the code that's making their layout. too many people just copy & past from a generator, slap on an image they found in google (or added some slanted lines in their stolen photoshop), and call it a masterpiece.
then again...even if you teach people how to center a layout, they'll still do it the wrong way. or they'll use two different percentages and wonder why when their screen isn't maximized their layout shoots in every which way. and as far as myspace goes, i dread the day when myspace decides to switch to web standards instead of garbled HTML. hell's gonna break lose. |
|
|
|
Aug 25 2008, 04:11 PM
Post
#3
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Staff Alumni Posts: 2,435 Joined: Feb 2007 Member No: 506,205 |
Moved to Designer's Cafe.
I agree with you when it comes to certain layouts, but there are others that the designer envisioned to be on the side. If the designer purposely aligned it to the side, then that was their design choice and you can't really criticize that. If someone just doesn't know how, then that's a problem. I'm surprised by how many people really don't know how to center their layouts. That question always comes up in the Myspace Support forum and PMs and messages I get. |
|
|
|
Aug 25 2008, 09:33 PM
Post
#4
|
|
![]() DDR \\ I'm Dee :) ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Mentor Posts: 8,662 Joined: Mar 2006 Member No: 384,020 |
If it is set up like a centered layout, then it should be centered. I agree.
|
|
|
|
Aug 28 2008, 05:51 PM
Post
#5
|
|
![]() torn ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 953 Joined: Oct 2004 Member No: 55,718 |
I came to hate making center-aligned layouts because xanga + divs + center-aligned + alignment in all browsers and screen resolutions = a lesson in frustration. Tables makes it better, but designing it requires more thought because you have to think of how to blend the sides into the background or think up a cool border/transition or something. If a layout's right- or left-aligned, there's one less side to worry about. Plus, like schizo said, some designs just look better aligned to the side.
|
|
|
|
Aug 30 2008, 08:36 PM
Post
#6
|
|
|
the name's mario ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 1,270 Joined: Jun 2008 Member No: 656,520 |
if the layout is meant to be centered then yes..
|
|
|
|
Aug 31 2008, 02:56 PM
Post
#7
|
|
|
Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Staff Alumni Posts: 4,665 Joined: Aug 2008 Member No: 676,364 |
I prefer centered. But sometimes right. :/
|
|
|
|
Sep 3 2008, 09:48 AM
Post
#8
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 |
It's easier than that; just do this:
CODE #centered {
display: block; margin-left: auto; margin-right: auto; } |
|
|
|
![]() ![]() |