Help:Wiki University Wikitext--Tables - Widths
- Nesting Lists
- Broken Links
- Image Embedding
- Image Tooltips & Borders
- Image Links
- Images & Text; Embedding PDF
- Snipping Tool & Paint
- Inline Styling
- Changing Fonts
- Font Colors
- Font Bold-Italics
- Div Tag - Intro
- Width and Height
- Alignment - Horizontal
- Breadcrumb Trails
This is our table from the last chapter:
- You will notice that the width is being controlled by the size and amount of text in the cells.
- What if you want the table to be as wide as the page, here we use our width attribute.
- Let's say we want it to cover the entire width or 100% of the page.
The width of a table or cell can be set with either percentages or a fixed amount in pixels. Whenever possible use percentages instead of fixed amounts. That way the table will look proportional to the page if it widens.
- We only need to add the width attribute to our opening table tag:
- PLEASE NOTICE the semi-colon that separates the border attribute from the width attribute. Remember we always use semi-colons to separate attributes.
Here is our little table with the width attribute installed:
Cell and column width
- The width of the cells is controlled by the text in the cells. Applying the width attribute for the entire table does not make the cells equal in width. If one cell had a large amount of text in it, the other cells will adjust smaller in size to maintain the over all width of the table and might be much smaller in width than in our example.
- To add some control over the width of cells or actually the columns, we need to install the width attribute in the top cells in each column as the top cells will influence the total column width and there is no need to enter the width to each cell.
- Let's make our table so each of the cells is 25% of the entire width of the table in other words make all the columns the same width.
Here's the coding:
- AGAIN NOTICE we are determining the width of the columns not just the width of the top row of cells.
- NOTICE the width attribute is separated from the border attribute by a semi-colon.
WIDTH ATTRIBUTES FOR PADS AND SMART PHONES
Try these out