DotDragnet
May 21, 2012, 06:16:33 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: follow us on twitter @dotdragnet
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Creating Columns  (Read 2023 times)
Barney McGrew
Sr. Member
****
Posts: 257


Resident Firefighter


View Profile WWW Awards
« on: December 23, 2007, 12:44:46 AM »

I have hit an hurdle in my new site. I am writing it in xhtml and have over 70 pages fully compliant so far. However, I now need to have 3, possibly four colums of information which I would have simply used a table for in the existing site. With xhtml I am presuming that tables are a no no, so I am presuming there is either a tag system or I have to use CSS, either way, I am stuck.

Any guidance on the above would be appreciated. smile

Logged
Chris H
Resident God Botherer
Global Moderator
Hero Member
*****
Posts: 2291



chrishall57
View Profile WWW Awards
« Reply #1 on: December 23, 2007, 06:54:54 AM »

Why would tables be a no-no?  unsure
Logged

samhs
Administrator
Hero Member
*****
Posts: 1711



View Profile WWW Awards
« Reply #2 on: December 23, 2007, 10:24:52 AM »

If it's tabular data, use a table. E.g. Each column relates to a different product, or an outcome, etc.

Otherwise, if it's a linear bit of prose you want to arrange into 4 columns, use <div>s set to 30% or 25% of the width of the content area, float them left, and then clear left after the last column thus:

Code:
  <!-- Let us assume you have a content div like this: //-->
  <div id="content">
     <div class="column">
        Some content in here....
     </div>
     <div class="column">
        Some content in here....
     </div>
     <div class="column">
        Some content in here....
     </div>
     <div class="column">
        Some content in here....
     </div>
     <div id="contentfooter">&nbsp;</div>
  </div>

That would be your html. Your CSS might be something like this:

Code:
   #content {
       position:   relative;
       width:      650px;
   }

   .column {
       float:        left;
       width:       150px;
       margin-left:10px;
   }

   #contentfooter {
       clear:        left;
   }

The margin-left is added to space the columns out, but you could acheive this other ways too....

hth
« Last Edit: December 23, 2007, 10:29:41 AM by samhs » Logged

Loose adj a not held together; not fastened or firmly fixed in place
Lose verb to misplace something. To fail to keep or obtain something, especially because of a mistake, carelessness, etc.
---
Blog: www.ohwrite.co.uk
Twitter: www.twitter.com/samhs
Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2267



ap4a.uk ap4a
View Profile WWW Awards
« Reply #3 on: December 23, 2007, 11:21:22 AM »

For left floated columns I'd use margin-right to separate them, to prevent IE 6 doubling the margin dimensions.

As has already been said though, if it's tabular data then it should be in a table.
Logged

Barney McGrew
Sr. Member
****
Posts: 257


Resident Firefighter


View Profile WWW Awards
« Reply #4 on: December 24, 2007, 12:13:28 AM »

Why would tables be a no-no?  unsure
I presumes everything in xhtml had to be done by using CSS and that the use of tables was no the thing to do anymore. unsure
Logged
sarahA
DDN Contribs
Hero Member
*****
Posts: 2174



View Profile WWW Awards
« Reply #5 on: December 24, 2007, 08:57:10 AM »

The use of tables for layout is no longer the done thing. But tables were created for a purpose, to display tabular data. So if your content is a set of tabular data then tables is the correct method to use smile
Logged

Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2267



ap4a.uk ap4a
View Profile WWW Awards
« Reply #6 on: December 24, 2007, 11:28:55 AM »

I presumes everything in xhtml had to be done by using CSS

Tables exist in XHTML, and can be styled with CSS too wink

Quote
and that the use of tables was no the thing to do anymore. unsure

As above. For tabular data they are the appropriate, semantic elements to use - and that's the point of it all, to use the most appropriate and semantic markup for a given purpose.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!