Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-18-2009, 03:16 AM
JakeS JakeS is offline
 
Join Date: Feb 2006
Location: United Kingdom
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default <table> <td> <tr> << Why are they thought of as "Evil"?

Hi Folks.

Just wondering here.

Why are <table> and it's partners hated so much? I mean a lot of people claim "To go css only"

I understand that, but you can anyway even if you use css.. for example:

Code:
<table class="table1layout">
You could then use css to alter it's width size etc. And it'll pass the strict validation check.

So why is it so bad?

I still use tables when I make websites. As I don't see why I have to change this for example:

Code:
<DOCTYPE HTML>
<html>
 <table class="table1layout>
    <tr>
         <td class="td1">My text here!!!!</td>
    </tr>
 </table>
</html>
to..

Code:
<DOCTYPE HTML>
<html>
 <div class="div1layout">
   <div>
      <div class="div1">My text here!!</div>
   </div>
  </div>
 </html>
Which basically, you end up with a div only document, and ends up getting confusing when coding when closing all the tags? (Eg make sure you close the right number of divs!)

But I really don't see any advantage to it. As it still passes validation with table. and yet, if I use div, sometimes it makes it a royal pain in the... to get the desired result as text will appear out of line etc.

So why are tables hated so much? Or was it simply started because some person prefered to just type div all day long?
Reply With Quote
  #2  
Old 07-18-2009, 11:21 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The world is moving to a place where data is separated from the presentation. That is, the styling is stored in CSS. This is called semantic (X)HTML. Tables are not all bad - they should still be used for tabular data. Currently, tables are used heavily in positioning, etc. This is what is "despised".
Reply With Quote
  #3  
Old 07-19-2009, 03:03 AM
JakeS JakeS is offline
 
Join Date: Feb 2006
Location: United Kingdom
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see.

So theirs not much choice eh?

I'm one of those people who use tables heavily in positioning. I'll go play with a website to see if I can replace them with a div, maybe some div will be able to work for me :-)

Thanks

EDIT:

Ok, switch everything to div and the site goes kboom and falls over

BTW: Is their any tags which do the same as tr and td? rather than just using div? as it's making it a royal pain.
Reply With Quote
  #4  
Old 07-19-2009, 04:05 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't think of just replacing tables, columns and rows with divs. For example, a list of links (e.g. navbar) should use use a ul (unordered list) element. Google around for some semantic HTML explanations.
Reply With Quote
  #5  
Old 07-19-2009, 05:55 AM
JakeS JakeS is offline
 
Join Date: Feb 2006
Location: United Kingdom
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well googling, tells me all this is to do is so the computer can read it?! I want people to read my site, not computers

I got my header working fine, that looks as it used to now, using only divs, were ul & ol etc would not be very useful anyway.

However, I've now got 2 problems.

Main content box has a margin.. and is still there, BUT. It's now got a frigging white border in place of a margin were it never used to, but had the margin matching the colour needed. Is there a way to fix that?

And now, I used to have 2 tables next to each other, one on the left, one on the right.. now it sits under it now it's a div!

Way to fix that?

Heres my code (without header and footer, as the main index pulls them in with a php require)

Code:
<div class="page">
<div class="toptr">

<div class="td100">
<br />
<div class="tmain">
    <div>
        <div class="tcat">&raquo;CobraOS</div>
    </div>
    <div>
        <div class="menuboxmiddle">Welcome!</div>
    </div>

    <div>
        <div class="alt1">
        <div class="alt1">
            <div>

    
                
            <!-- INFO -->
            
            
                <div style="margin: 10px;">
                    ~snip text content~
                <br /> <br />
               ~and again it's just text~
                </div>
            </div>

        </div>
        </div>
    </div>

</div>
<div>
<div class="tmenu">
<div>    
    <div class="tcat"><strong>&raquo;Screenshots</strong></div>
</div>
<div>
    <div class="menuboxmiddle">Gallary</div>
</div>
<div>
    <div class="alt1">
        <video src="sources/video/front.ogv" controls="controls" class="frontvid">  
                Hmm. Seeing this text? Here's some possible reasons: <br />
                <br />
                1. Your blocking all webpage scripts <br />
                2. Your browser does not like HTML5 video <br />
                3. Your browser doesn't support mp4 or Ogg Vorbis  
        </video><br /> <br /><a href="watch.php">See More!</a> 

    </div>
</div>
    </div>



<br />

    
</div><br />
</div>
Any idea what I'm doing wrong?

Some of the CSS being used in that particular template file:

Code:
.tmain
{
    border: solid 1px;
    margin-left: auto;
    margin-right: auto;
    padding: 0px;
    border-spacing: 0px;
    width: 100%;
}
.tmenu
{
    border: solid 1px;
    margin-left: auto;
    margin-right: auto;
    padding: 0px;
    border-spacing: 0px;
    width: 175px;
}
.page
{
    background: #FFFFFF;
    color: #000000;
    padding: 0px;
    border-spacing: 20px;
    border: 0px;
    margin-left: auto;
    margin-right: auto;
    width: 1000px;
    font: 10pt sans, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
.menuboxmiddle
{
    background: #fff url(../images/headerbackgroundlinks.gif) repeat-x top left;
    border: 1px;
    color: #000;
    padding: 0px;
    height: 15px;
    font: 10pt sans, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
    text-align: center;
}
.tcat
{
    background: #0140a8 url(../images/headerbackground.png) repeat-x top left;
    color: #FFFFFF;
    border: 1px #000;
    height: 27px;
    font: bold 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
    padding: 0px;
}
.alt1, .alt1Active
{
    background: #F5F5FF;
    color: #000000;
    font: 10pt sans, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
    
}
Think that's all.

PS: Sorry for the odd questions. I know it's not related to vB.. but I figured.. What better place to ask than a modification community? where most of the people modify templates all day

This worked fine when it was tables and td's etc.

I learn from example and from seeing code and trial and error.. a block of writing would just confuse me. Just so you know

Thanks again!
Reply With Quote
  #6  
Old 07-19-2009, 07:14 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by JakeS View Post
Well googling, tells me all this is to do is so the computer can read it?!
Kind of. Semantic HTML is the creation of HTML documents with the author's intended meaning (and a tag's intended meaning). The famous example is the use of tables for positioning. Tables are for tabular data, not to position things. Another is <i> and <em>. A by-product of this is the fact that spiders can "read" a site better.

Again, semantic HTML is not replacing all tables with divs. I can see in your code there are just random nested containers. An example is this:
HTML Code:
<div>    
    <div class="tcat"><strong>&raquo;Screenshots</strong></div>
</div>
<div>
    <div class="menuboxmiddle">Gallary</div>
</div>
A menu is a list of links, and therefore should use a <ul> (unordered list) element. That's the kind of stuff semantic HTML intends to be.
Quote:
Originally Posted by JakeS View Post
Main content box has a margin.. and is still there, BUT. It's now got a frigging white border in place of a margin were it never used to, but had the margin matching the colour needed. Is there a way to fix that?
Screenshot example please? Don't really understand the problem.
Quote:
Originally Posted by JakeS View Post
And now, I used to have 2 tables next to each other, one on the left, one on the right.. now it sits under it now it's a div!
Have you tried floating the containers?
Reply With Quote
  #7  
Old 07-19-2009, 09:02 AM
1Unreal 1Unreal is offline
 
Join Date: Jul 2008
Location: London
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When they are used for layouts and positioning they create lots of markup which makes it harder to find bugs and things. Also divs have alot less markup when making a big app. This makes editing things easier.
Reply With Quote
  #8  
Old 07-19-2009, 09:20 AM
JakeS JakeS is offline
 
Join Date: Feb 2006
Location: United Kingdom
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see.

I've attached 2 screenshots, one is how it's supposed to look, and is using tables. Other is using divs and is quite badly broken.

Also, Here is the original table code:

Code:
<table class="page">
<tr class="toptr">

<td class="td100">

<table class="tmain">
    <tr>
        <td class="tcat">&raquo;CobraOS</td>
    </tr>
    <tr>
        <td class="menuboxmiddle">Welcome!</td>
    </tr>

    <tr>
        <td class="alt1">
        <div class="alt1">
            <div>

    
                
            <!-- INFO -->
            
            
                <div style="margin: 10px;">~snip~
                <br /> <br />
               ~snip~
                </div>
            </div>

        </div>
        </td>
    </tr>

</table>
<br />
<td>
<table class="tmenu">
<tr>    
    <td class="tcat"><strong>&raquo;Screenshots</strong></td>
</tr>
<tr>
    <td class="menuboxmiddle">Gallary</td>
</tr>
<tr>
    <td class="alt1">
        <video src="sources/video/front.ogv" controls="controls" class="frontvid">  
                Hmm. Seeing this text? Here's some possible reasons: <br />
                <br />
                1. Your blocking all webpage scripts <br />
                2. Your browser does not like HTML5 video <br />
                3. Your browser doesn't support mp4 or Ogg Vorbis  
        </video><br /> <br /><a href="watch.php">See More!</a> 

    </td>
</tr>
    </table>



<br />

    
</td>
</tr>
As you can see pre-div it was not just duplicating tags.

Floating containers? Never heard of them x-x. care to provide some examples?

Also "menuboxmiddle" is simply the refer to css. originally made for the old side menu (Which is extinct)

Thanks!

PS: Attachments look awful after uploading them
Attached Images
File Type: jpg Screenshot-4.jpg (106.3 KB, 0 views)
File Type: jpg Screenshot-5.jpg (107.7 KB, 0 views)
Reply With Quote
  #9  
Old 07-19-2009, 10:58 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can't just take an existing layout and "semanticise" it. (Well, you can, but it takes a lot of work.) You will probably be better off starting afresh, with guidance from the many websites out there who provide tutorials and the such.
Reply With Quote
  #10  
Old 07-19-2009, 11:43 AM
JakeS JakeS is offline
 
Join Date: Feb 2006
Location: United Kingdom
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm ok. Well I guess it's back to the "drawing board" for me (Yes I really have one actually)

Considering tables are not "extinct" just yet. I've decided to roll out the table version at first (When it's complete). And then later on start work with a new one (Using semantic html) :-).

For me that's more convenient, as firstly, I don't basically throw away a whole website and at the moment my time on coding the website half is.. well in half (I got more than websites to code with this project )

Thanks guys for advise and such
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 03:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04214 seconds
  • Memory Usage 2,299KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (1)bbcode_html
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete