Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
best way to code a layout.
Old 03-01-2007, 01:40 PM best way to code a layout.
Novice Talker

Posts: 14
Name: Dom
Trades: 0
thanks everyone for helping out. =]

Last edited by pixelxs; 03-06-2007 at 11:12 AM..
pixelxs is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-01-2007, 02:03 PM Re: best way to code a layout.
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
The easiest way of doing it is enclosing everything in your <body> tag by a <center> tag.

Regards,
Insensus
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 02:15 PM Re: best way to code a layout.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
NO ! The <center> tag is deprecated and should NOT be used.
If you're going to use CSS, use it to center your layout.

Add this to your rules for <body>
text-align: center; *** makes IE 6 & below center

Then, if you have wrapped your entire fixed-width layout inside a #wrapper div (which you should to make this easy), add this to the rules for the #wrappper:

margin: 0 auto; ** centers for all other browsers **

Make sure you give your #wrapper a defined width or it won't work.

Oh.. and the BEST way to code a layout -- NO TABLES !!!!
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Last edited by LadynRed; 03-01-2007 at 02:16 PM..
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 02:17 PM Re: best way to code a layout.
Novice Talker

Posts: 14
Name: Dom
Trades: 0
i'll try that now.
thanks alot!
i'll definetley try NOT to use tables! =]

Last edited by pixelxs; 03-01-2007 at 02:19 PM..
pixelxs is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 02:20 PM Re: best way to code a layout.
Tom_M's Avatar
Ultra Talker

Posts: 250
Name: Tom Maurer
Location: Pennslvania, USA
Trades: 0
I'm not sure why your table based layout has the need to be positioned? Positioning your tables in this case is just extra markup if you ask me. Is there a reason why you chose to position everything like that?
Tom_M is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 02:20 PM Re: best way to code a layout.
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
I'm sorry.
I'm not too good you know.
LadynRed already specified your solution.

Regards,
Insensus
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 02:25 PM Re: best way to code a layout.
Novice Talker

Posts: 14
Name: Dom
Trades: 0
well really i've only used a table for the main content, and i've used css to position that because i had to position it above the image.

And insensus, It's all good! believe me, i'm not too good at this myself! which is why i probably sound like a complete newbie!
pixelxs is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 02:36 PM Re: best way to code a layout.
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Quote:
Originally Posted by pixelxs View Post
so far i've tried positioning the tables with css, and it's worked fine!
Wow! You can use css and tables in the same sentence after all!
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 02:47 PM Re: best way to code a layout.
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
Of course you can!
I'm using css to style my tables for a school site I'm making.

Regards,
Insensus
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 03:00 PM Re: best way to code a layout.
RanaD's Avatar
Super Talker

Posts: 139
Name: David
Trades: 0
Quote:
Originally Posted by Learning Newbie View Post
Wow! You can use css and tables in the same sentence after all!
lol...You can also do a layout with tables, but do you want to?
RanaD is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 03:13 PM Re: best way to code a layout.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
It's perfectly acceptable to style a DATA table with CSS, it is the better method.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 09:51 PM Re: best way to code a layout.
taketherisk's Avatar
Skilled Talker

Posts: 89
Name: Brett
Location: New Zealand
Trades: 0
I always center my fixed width layouts with the following code:

CSS:
Code:
.wrap1 {
  text-align: center;
}
.wrap2 {
  margin-left: auto;
  margin-right: auto;
}

HTML:
Code:
<div class="wrap1">
<div class="wrap2">

<div>Centered div....</div>

</div>
</div>
Hope this helps...
-Brett
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
taketherisk is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 01:41 AM Re: best way to code a layout.
Skilled Talker

Posts: 61
Location: Dhaka, Bangladesh
Trades: 0
Is there any advantages in using 2 classes? Why not use single class?

Quote:
.wrap {
text-align: center;
margin-left: auto;
margin-right: auto;
}

<div class="wrap">
<div>Centered div....</div>
</div>
__________________

Please login or register to view this content. Registration is FREE
: Quantumcloud

Please login or register to view this content. Registration is FREE
: dna88
quantumcloud is offline
Reply With Quote
View Public Profile Visit quantumcloud's homepage!
 
Old 03-02-2007, 01:59 AM Re: best way to code a layout.
taketherisk's Avatar
Skilled Talker

Posts: 89
Name: Brett
Location: New Zealand
Trades: 0
I'm not sure...

I tought myself most of this stuff.
But now that you say it... i'm really stumped on why i didn't try this before.
*** laughs at self ***

Both ways work the same, but from now on i will be using just one class, thanks for pointing that out.

You can also use:
Code:
.wrap {
position: absolute;
left: 50%;
}
But i wouldn't use this way... ever.

-Brett
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Last edited by taketherisk; 03-02-2007 at 02:03 AM..
taketherisk is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 05:43 AM Re: best way to code a layout.
RanaD's Avatar
Super Talker

Posts: 139
Name: David
Trades: 0
Code:
.wrap {
  text-align: center;
  margin: 0 auto;
}
 
<div class="wrap">
<div>Centered div....</div>
</div>
RanaD is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 07:32 PM Re: best way to code a layout.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
The margin: 0 auto will work fine for any browser except IE6 or older. For THAT browser, you have use text-align: center in the rules for the <body> tag, AND you have to use the 'wrapper' to contain the rest of your fixed-width layout. Using position: absolute is generally not a good solution.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 08:32 PM Re: best way to code a layout.
Angelosanto's Avatar
Webmaster Talker

Posts: 554
Name: Danny Angelosanto
Trades: 0
Good to see you pulling out the tables! They really don't do the job like divs. I have to say, this is quite a strange page. I do like it though
__________________
"Those who believe in telekinetics, raise my hand."
-Kurt Vonnegut
_____________________________________
Angelosanto is offline
Reply With Quote
View Public Profile Visit Angelosanto's homepage!
 
Old 03-03-2007, 01:39 AM Re: best way to code a layout.
taketherisk's Avatar
Skilled Talker

Posts: 89
Name: Brett
Location: New Zealand
Trades: 0
Quote:
Using position: absolute is generally not a good solution.
I totally agree, from a SEO point of view and coding point of view...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
taketherisk is offline
Reply With Quote
View Public Profile
 
Old 03-03-2007, 06:37 AM Re: best way to code a layout.
greenlush's Avatar
Ultra Talker

Posts: 481
Name: Jason - Greenlush.com
Location: Bradford, UK
Trades: 0
Use clean code, no errors full valid mark up, notepad is your best tool i would say
greenlush is offline
Reply With Quote
View Public Profile Visit greenlush's homepage!
 
Old 03-04-2007, 12:47 AM Re: best way to code a layout.
taketherisk's Avatar
Skilled Talker

Posts: 89
Name: Brett
Location: New Zealand
Trades: 0
In my opinion notepad is like the worst way lol.

Use dreamweaver or html-kit

They both color the tags and attributes. Also html-kit has HTMLtidy, which converts code to XHTML valid.

-Brett
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
taketherisk is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to best way to code a layout.

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting 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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.59989 seconds with 12 queries