![]() | HTML TABLES! | ![]() |
Sponsor Links Free Image Hosting Your source for free image hosting - upload your images! Poker Strategies and Tips Poker, online poker, poker terms, poker accessories, poker tips and tricks. Photoshop Tutorials Over 3,000 tutorials for Photoshop, Flash and 3DS Max! 6,000 Free Fonts Download over 6,000 Free Fonts for Mac and PC @ FontVillage.com Buy Website Visitors 1,000 Targeted U.S. Visitors for $3.50 - 30 day guaranteed. Reading Tarot Cards Videochat with certified tarot readers & psychics - unlimited tarot cards readings! Affiliate Software Start an affiliate program and design to maximize affiliates' productivity PPC Search Engine Low cost advertising for your website! Technical Service Provider Your number one source for computer repairs and network solutions | LESSON 1-05-04: Merging Table Cells Web Design Lessons > Lesson 1-05-04: Merging Table Cells
In this little section of our free online web design course, we're going to learn how to merge table cells by using the "colspan" and "rowspan" attributes along with the <td> tag. Merging HTML Table Cells HorizontallyIn order to merge table cells horizontally, we've got to use the "colspan" attribute and the number of cells you wish to merge horizontally. Below is the HTML code we used to build the 9-cell-table in web design lesson 1-05-01:
As you know, this HTML code produces the below output:
Now, if we wish to merge the three cells in the second row horizontally to form one big cell in the middle of our table, we'll have to use our "colspan" attribute with the value of "3" as we want to merge 3 cells. We're going to put the "colspan" attribute into the first <td> tag on that row. The HTML code is below:
Note that you should not add any more <td> tags inside the middle row to be able to merge all of the three cells. The above HTML code produces the below output:
You see how the middle cells merged into one single cell? Great, isn't it? Now let's merge table cells vertically by using the "rowspan" attribute! Merging HTML Table Cells VerticallyYour free online web design course will now merge the middle column (Column 2) in the above 9-cell-table. To do that, we'll use the "rowspan" attribute inside the first middle <td> tag and remove the other two middle <td> tags from the second and third rows to have one cell that spans three rows! Have a look at the HTML code below to get a clearer picture:
Notice how I removed the other two middle <td> tags and only left the first and third columns in the second and third rows of the table. The output of the above HTML code is below:
Sidenote #1: Check out my web design resources page to download a superb eBook! Sidenote #2: If you enjoyed this lesson, please link to it :) We're done! In the next lesson of our online web design course, you're going to learn how to use tables to create a site layout.
Nearby Lessons: • Lesson 1-03 Basic Text Formatting• Lesson 1-04 Web Colors Unleashed • Lesson 1-05 HTML Tables • Lesson 1-06 Background Alteration • Lesson 1-07 Images Back To Top Home | Resources | Articles | Lessons | Directory | Forums Copyright© 2004 Onur Özcan. All Rights Reserved. | Partner Links | |||||||||||||||||||||||||||||||||||||