Web Design Stuff
HTML Tutorials    CSS Tutorials    Web Hosting   Resources
Create a Web Page 101
Making Web Pages Intro What is a Web Page? Why Make a Web Page? The History of HTML Learn HTML or XHTML?
Basic HTML
Basic HTML Tutorials Basic HTML Necessities How to Make a Web Page How to Edit a Web Page The Basics of HTML Tags Basic HTML Page Structure HTML Attributes
HTML Font Codes
HTML Font Codes Intro HTML Font Color Codes HTML Font Size Codes HTML Font Style Codes HTML Bold/Italic Codes Combining Font Codes
Formatting Text
Formatting Text Intro Making Paragraphs Miscellaneous Formatting Headings & Subheadings Creating Hyperlinks
Using Graphics
Using Graphics on the Web Add Graphics to Your Pages Graphics and Accessibility How to Align Graphics Page Color & Background Graphics as Hyperlinks Horizontal Rules
Creating Tables
HTML Tables Tutorials HTML Table Fundamentals Background & Border Color Table Frames & Rules Table Width and Alignment Cells 1 -Space & Alignment Cells 2 -Row Column Span Cells 3 -Width & Height
Making Lists
HTML Lists Tutorials Bulleted Lists Numbered Lists Definition Lists
HTML Frames
HTML Frames Tutorials Using Frames for Layout Advanced Frame Layouts Putting Hyperlinks in Frames Frame Border Width Color, Margin and Control Problems with Frames SmartFrames: A Solution SSI: An Alternative to Frames
Web Page Forms
Making Feedback Forms A Simple Feedback Form Installing NMS FormMail Debugging Your Setup My Web Host is Out to Lunch User Input Components Text Fields Checkboxes & Radio Buttons Dropdown Menus Push Buttons Layout and Presentation
Basic CSS
Basic CSS Tutorials What is CSS? Why You Should Use CSS How to Use CSS Inline Styles Embedded Style Sheets External Style Sheets Class Selectors ID Selectors Combining Selectors
CSS Properties
CSS Properties Intro Font Styles Width, Height & Spacing Borders Backgrounds Position Float & Alignment Hyperlinks
All About Web Hosting
Hosting Your Own Website What is a Web Host? Your Website's Home Page Building a Website Offline About Free Web Hosting Best Free Web Hosting Commercial Web Hosting How to Get a Domain Name Ecommerce Web Hosting Web Hosting Terminology
Free Web Design Tools
Best Free Website Tools Best Free Text Editors Best Free Graphics Editors Free Website Analysis Tools
Setting Up HTML Kit
HTML Kit Introduction How to install HTML Kit Screenshot Breakdown Basic Configuration Overall Appearance Shortcuts and Startup Editing Window Customizing Toolbars Using the Favorites Tab Making a New Actions Bar Odds and Ends
Free Templates
Free Website Templates Two Column Fixed Width Three Column Liquid Layout Miscellaneous Templates Dynamic Menu Effects Two Column Experimental Terms of Use About These Templates
Website Templates Help
Getting Started Template Zip File Download How to Edit Your Template What to Edit in the HTML How to Add Your Logo Making a Website
Web Design Tips
Web Design Basics Tables vs. Tableless Using Tables for Layout Example Table Layouts World's Crappiest Web Page
Twitter Backgrounds
Twitter Backgrounds Intro Cool Twitter Backgrounds Cool Twitter Backgrounds 2 Plain Twitter Backgrounds Dark Twitter Backgrounds Best Twitter Backgrounds Cute Twitter Backgrounds Music Twitter Backgrounds Music Twitter Backgrounds 2 Twitter Backgrounds 101 TERMS OF USE
All About Web Browsers
What is a Web Browser? Mozilla Firefox Internet Explorer Opera How to Set Up Firefox Top 5 Firefox Extensions
 
Contact
Post Some Feedback Send Me An Email Iron Spider Blog About Iron Spider... Site Conventions
 
 
 

 

Table Cells - Width and Height

 
<td
width="pixels or percentage"
height="pixels or percentage">
...</td>
 
 
Sets width of the table cell
Sets height of the table cell
 
Web browsers will automatically set the dimensions of the rows and columns in your web page table according to how much content your table cells contain. Since cells are displayed in a grid-like pattern then the cell containing the most content will typically set the width and height of all cells adjacent to it and hence establish the width and height of related rows and columns in your table.

You can, however, apply the width and height attributes to your <td> tags to explicitly set the dimensions of your table cells and thus exercise control over the width and height of rows and columns.

These attributes are described in more detail below:
  • width="pixels or percentage" ~ Using the width attribute in your <td> tags, you can explicitly set the width of your table data cells. This will have the effect of setting not only the width of that particular cell but will also set the width of the entire column in which that cell resides. You may define either a fixed width in pixels or a relative width (recommended) which is equal to a percentage of the table width.

    NOTE: In the case where the width attribute is set in more than one cell in the same column, the largest width is the one that is applied. Likewise, if the content in any table cell in that column (such as a graphic) outsizes a specified width, the width of the content will establish the width of the cell and the column it resides in.

    Example 1 below renders a table that is 500 pixels wide and has two columns. The width of the first table data cell is set to 25% which then sets the width of all the cells in Column 1 at 25% or 125 pixels (25% of 500 = 125). The width of all the cells in Column 2 default to the remainder of table's width (75%):

    Example 1 - SOURCE CODE

    <table width="500" border="5">
       <tr><td width="25%">Column 1</td><td>Column 2</td></tr>
       <tr><td>Column 1</td><td>Column 2</td></tr>
       <tr><td>Column 1</td><td>Column 2</td></tr>
    </table>



    Example 1 - RESULT
    Column 1Column 2
    Column 1Column 2
    Column 1Column 2


  • height="pixels or percentage" ~ Using the height attribute in your <td> tags, you can explicitly set the height of your table data cells. This will have the effect of setting not only the height of that particular cell but will also set the height of the entire row in which that cell resides. You may define either a fixed height in pixels (recommended) or a relative height which is equal to a percentage of the table's height.

    NOTE: In the case where the height attribute is set in more than one cell in the same row, the largest height is the one that is applied. Likewise, if the content in any table cell in that row (such as a graphic) outsizes a specified height, the height of the content will establish the height of the cell and the row it resides in.

    Example 2 renders a table that is 500 pixels wide and has two rows. The height of the first table cell in Row 1 is set to 100 pixels which then sets the height of all cells in Row 1 to 100 pixels. The height of Row 2 is not affected by the height specification in Row 1.

    Example 2 - SOURCE CODE

    <table width="500" border="5">
    <tr><td height="100">Row 1</td><td>Row 1</td><td>Row 1</td></tr>
    <tr><td>Row 2</td><td>Row 2</td><td>Row 2</td></tr>
    </table>


    Example 2 - RESULT
    Row 1Row 1Row 1
    Row 2Row 2Row 2

Well that's it for tables. The next section of Iron Spider will deal with all the ins and outs on how to make lists...





Best Free Stuff
for webmasters

Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates

See also:

Best Free Web Hosting

 

If you need a .COM web address, you can get one quick and easy at...

www.GoDaddy.com
<~BACK TOP NEXT ~>
 
HTML Tutorials |  CSS Tutorials |  Web Hosting |  Domain Names |  Web Design Resources
Iron Spider © Copyright 2004-2011 Robert Darrell