|
|
|
|
![]() ![]() |
Apr 27 2008, 09:29 PM
Post
#1
|
|
|
Newbie [Level 2] ![]() ![]() Group: [HOSTED] Posts: 29 Joined: 27-April 08 From: Behind You! Member No.: 61,399 |
If you are a novice web designer, but want your site to look advanced and proffessional, then what better way to do so than to use HTML tables?
HTML tables are a really easy way of formatting your text, to make your ste look proffesional. It looks good, and its easy, what more can you ask for? You have to use the <table> tag, so first lets start off with: HTML <Table> </table> In between theese two tags, we will add the data for the table, using the tags <td><tr> and <th>. <th>=Table Heading (Title) <td>=Table Data (what you want in the table) [if you do not use this then the text will appear outside of the table rather than in it] <tr>=table row (new row) So, lets get started. HTML <table> <th><tr><td> HEADING </th></td></tr> <tr><td> SUB TEXT</tr></td> <tr><td><th>ANOTHER HEADING</tr></td></th> <tr><td> SUB TEXT</tr></td> </table> Thats the basics sorted, just add more if you need more heading/subtexts, or remove if you need less. Now, lets sort out the border, and alignment. You do this in the <table> tag. HTML <table border="1" align="left"> <th><tr><td> HEADING </th></td></tr> <tr><td> SUB TEXT</tr></td> <tr><td><th>ANOTHER HEADING</tr></td></th> <tr><td> SUB TEXT</tr></td> </table> The border="1" simply means theres a size one border. if you want the thickness of this border increasing, then increase the number. To change alignment, you can choose to align="right", if you want it centered it may be easier to follow this code: HTML <center><table border="1"> <th><tr><td> HEADING </th></td></tr> <tr><td> SUB TEXT</tr></td> <tr><td><th>ANOTHER HEADING</tr></td></th> <tr><td> SUB TEXT</tr></td> </table></center> (The background colour goes off the normal default, or whats in your body tag) E.G. HTML <body bgcolor="red"> <center><table border="1"> <th><tr><td> HEADING </th></td></tr> <tr><td> SUB TEXT</tr></td> <tr><td><th>ANOTHER HEADING</tr></td></th> <tr><td> SUB TEXT</tr></td> </table></center> </body> (This also works for text color.) Thats more or less it, your step by step guide to HTML tables. If you have anymore questions you need to ask, go ahead. Thanks. |
|
|
|
Apr 27 2008, 09:45 PM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,753 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
Besides creating a 'professional' presentation of Data, there should be a focus on Accessability, too.
I recommend the following link from the w3c Group that deals with this issue in depth. http://www.w3.org/TR/WCAG10-HTML-TECHS/#tables Notice that the Table tag should not be used to structure a page, though. it should only be used for presentation of 'tabular' data. if the data comes pout of a database, it is likley a good candidate for using a table, otherwise, consider the use of CSS div's for the page structure. |
|
|
|
Apr 28 2008, 04:42 PM
Post
#3
|
|
|
GOD's Favourite Athiest ![]() Group: [MODERATOR] Posts: 1,169 Joined: 11-February 05 From: London, UK Member No.: 3,709 |
What happened to your code? You've nested the HTML incorrectly. You've written the code this:
HTML <a><b><c> XYZ </a></b></c> When it should be: HTML <a><b><c> XYZ </c></b></a> Also, in one line, you wrote: HTML <th><tr><td> HEADING </th></td></tr> You've started a table cell (in tag <th>) outside of any table row! Also, <th> and <td> are treated exactly the same so <tr><th></th></tr> is valid on its own, without a <td>. So code like this: HTML <table border="1" align="left"> <th><tr><td> HEADING </th></td></tr> <tr><td> SUB TEXT</tr></td> <tr><td><th>ANOTHER HEADING</tr></td></th> <tr><td> SUB TEXT</tr></td> </table> Should be: HTML <table border="1" align="left"> <tr><th> HEADING </th></tr> <tr><td> SUB TEXT</td></tr> <tr><th>ANOTHER HEADING</th></tr> <tr><td> SUB TEXT</td></tr> </table> Compare the difference in terms of output: ![]() Looks quite trivial but in terms of output it's not. Good effort but you still have a fair bit of learning left to do! |
|
|
|
Apr 28 2008, 07:11 PM
Post
#4
|
|
|
Newbie [Level 2] ![]() ![]() Group: [HOSTED] Posts: 29 Joined: 27-April 08 From: Behind You! Member No.: 61,399 |
Thanks electric, I was just about to ammend this after I realised my method was wrong (after I started designing my site) But you beat me to it.
Thanks. |
|
|
|
Apr 29 2008, 09:34 PM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 419 Joined: 13-October 06 From: Alberta, Canada Member No.: 31,584 |
If you know CSS, I would advise using that to create your layouts and templates, instead of tables. Table suck up bandwidth, and are not very professional anymore.
|
|
|
|
Apr 29 2008, 09:56 PM
Post
#6
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 152 Joined: 24-May 07 From: Brisbane Member No.: 43,581 |
If you have dreamweaver or any other WYSIWYG, then use it. Tables are good for some things, but don't rely on it 100% for your site- there are such things as divs and other ways to make a page index nice. CSS is good to use too...
|
|
|
|
Apr 30 2008, 07:44 AM
Post
#7
|
|
|
Newbie ![]() Group: Members Posts: 7 Joined: 27-April 08 Member No.: 61,384 |
I would like to add a usual technique used by web designers.
Most of the websites (or webpages) use tables; so it is a nice idea to use tables with border=0. Doing this gives you a very good control over the display of the webpage. For example: consider a form for entering comments on a website. Instead of simply designing the form like: HTML <form> Enter Your Name: <input type=text name="name"><br> Enter Your Email: <input type=text name="email"><br> Enter Comments: <textarea></textarea> </form> it would be better to code as: HTML <form><table align=center border=0> <tr><th>Enter Your Name:</th><td><input type=text name="name"></td></tr> <tr><th>Enter Your Email:</th><td><input type=text name="email"></td></tr> <tr><th>Enter Your Comments:</th><td><textarea></textarea></td></tr> </table></form> Submit buttons and reset buttons can also added. It also gives a good output. Thank you. |
|
|
|
Apr 30 2008, 02:54 PM
Post
#8
|
|
|
apt-get moo ![]() Group: [MODERATOR] Posts: 1,920 Joined: 28-May 05 From: Hertfordshire, England Member No.: 7,593 ![]() |
it would be better to code as: HTML <form><table align=center border=0> <tr><th>Enter Your Name:</th><td><input type=text name="name"></td></tr> <tr><th>Enter Your Email:</th><td><input type=text name="email"></td></tr> <tr><th>Enter Your Comments:</th><td><textarea></textarea></td></tr> </table></form> That code is not better, but wrong. A form is not tabular data, so does not belong in a table. Also, the align tag has been deprecated since HTML 4, so should not really be used. |