Computers, Software
Using HTML in a table
In HTML there are so many elements, and each of them is unique in its own way. The table is a very interesting, demanded and serious object. Thanks to it you can not only provide information in a convenient form, but also build a whole frame of the site.
Previously, almost all webmasters used tables for site layout. Initially, tables for this were not invented. Therefore, to mark up a site, you need to use the block div element.
If you do not want to always be a novice, get used to doing everything right right away. This is very important in HTML. In the table you need to place only the usual information (text, links, lists, images, etc.), and not the whole site.
How to make an HTML table?
A table is a complex element, which consists of a large number of other elements. Remember that when creating cells or rows, you should always put a closing tag at once. Otherwise everything will fly away. The handler in the browser will look for the end of the element and, until it finds it, everything else will be included in the table. The result will be porridge.
If you write a website in "Notepad", then all you have to do with your hands. If in the finished editor, then there are usually buttons - "insert a table", "insert an image" and so on.
Example of the table 2 to 2.
Tr> Tr> Table> The The main rule: the number of cells in each line should be the same. It's a table. But, as in the Word and Excel editor, cells can be combined with each other. To combine, use the Colspan and Rowspan attributes. Span translates as "embrace" or "overlap". The literal meaning is to cover / cover cells / lines. In the value of this attribute, you need to specify how many rows or cells will be blocked. The following is a good example of using both HTML attributes in a table. In this example, on the first line, 3 cells were combined using the colspan = "3" attribute. Then the first cell of the second row was stretched into four lines. Remember that we stretch / unite only in the first cell. Its property will be extended further. Everything that goes before will not be affected. If you have 5 cells and you want to merge from 2 to 4, you just need to specify the colspan = "3" attribute in cell number 2. Note the cell number 9 in the figure above. There they combined both cells and lines at once. Such actions are not prohibited. Look at another example to fix the information. Because some confuse attributes and sometimes combine strings instead of cells. Take the usual, standard HTML case. The table has two rows of two cells each. The result of the code will be as follows. As you can see, there are no effects. You can add a frame, specify the width and height. You can also play with the alignment. You can align both height and width. Align for horizontal alignment, and valign for vertical alignment. Here is the result. The align and valign attributes can be applied to the entire string. Then all the cells that are in it will be subject to these attributes. In addition to the Like any HTML tags, the table can be converted through styles. You need to specify a style file in the head or Ready style (also indicated in the head). ... Table { Font-family: Verdana, Arial, Helvetica, sans-serif; Color: # 000000; } .my_class { Color: # 666666; } Style> ... Head> If you specified just a table, then this style will apply to all tables on the page. Absolutely to all. But, if you use the second method, where you specify an arbitrary name with a period, then this style can be applied to any desired table, without affecting others. Note that you can use classes for both the table tag and for a particular cell or row. Tr> Tr> Table> If there is an error somewhere in the style name, you will not see the result. If there are mistakes in the style itself, but the names coincide, there will be no effect. Each comma or colon is important. What attributes can be written in style classes? There are a lot of attributes that apply to tables. Consider the most basic that you need. Align Horizontal Alignment Valign Vertical alignment Background Background image in cell / table Bgcolor Background color in cell Bordercolor Table / cell border color Height Cell height Nowrap Prohibits the transfer of text in a line. Width Width of cell / table As you can see, you can use HTML in the table with a huge number of "tools". Thanks to the styles, you can create various beautiful tables. It all depends on what you like and how. As you can see, if you use HTML tags, the table can be transformed beyond recognition. The limits of possibilities are determined by your imagination.
the text of the first cell of the first line td>
the text of the second cell of the first line td>
the text of the first cell of the second line td>
the text of the second cell of the second line td>
and table> tags indicate the beginning and end of the table. The
and tr> tags are the beginning and end of the line. In one line there can be as many cells as are defined by the and td> tags.
How to merge cells in a table?
Designing tables
and tags, there is an additional tag. In fact, this is an analog of , but it is used only in the first line and serves as a header. By default, the text in is centered and bold.
How to connect styles to a table?
the text of the first cell of the first line td>
the text of the second cell of the first line td>
the text of the first cell of the second line td>
the text of the second cell of the second line td>
Additional attributes for tables
Beautiful created using HTML tables. Examples
Similar articles
Trending Now
Newest