Вы находитесь на странице: 1из 8

This Tutorial will teach you how to markup text, and how to change its appearance with CSS.

A Paragraph is a section of text, generally same rules apply as in books. However line breaks are more frequent in text on web pages, which increases readability when done right. Headings are also sections of text, though smaller then Paragraphs. Newspapers commonly use "headlines", they often appear as bold text in a larger size then the rest of the article. Paragraphs In theory you could just write plain text to the browser, but in practice you should markup text with p elements and other relevant elements, don't wrap text in div elements alone. The div element has no meaning, and is mainly used for styling purposes. Paragraphs are block elements, and can be placed inside other blocks, such as header, footer, div, and article. Etc. You can also place them directly in the body, which is what we will be doing in this Tutorial. Headings

Like we have headlines in books, newspapers, and magazines. Etc. We also got headlines on web pages. To create a headline, you should use the h1 to h6 elements. These elements are used to create a header level, where h1 has the highest level, h6 has the deepest level. The number of the header doesn't matter, if the header is used together with the section element, in which case the section element determines the section level. You can read more about this in the tutorial titled: Semantic elements of HTML Its important that you use headers correctly, to properly transfer "meaning" into your pages. The first header (h1), should be used for the main article header, where h2 can be used as subsections to h1, and h3 to h2. Etc. If you have navigation columns on your page, then its best to use h1 for the headers on those, rather then using h2. This is to properly indicate relasionship between your sections, the navigation section has nothing to do with the main article. A lot of web designers are using h2 for navigation columns, because they make the incorrect asumption, that you can't have multiple h1s on a page. Don't make the same mistake. \

HTML HOME HTML Introduction HTML Basic HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Formatting HTML Editors HTML CSS HTML Links HTML Images HTML Tables HTML Lists HTML Blocks HTML Layout HTML Forms HTML Iframes HTML Colors HTML Colornames HTML Colorvalues HTML Quick List

HTML Advanced
HTML DOCTYPE HTML Head HTML Scripts HTML Entities HTML URLs

HTML URL Encode HTML Webserver HTML Summary

HTML Media
HTML Media HTML Object HTML Audio HTML Video HTML YouTube

HTML XHTML
XHTML Introduction XHTML Elements XHTML Attributes

HTML Examples
HTML Examples HTML Quiz HTML Certificate

HTML References
HTML Tag List HTML Attributes HTML Events HTML Colornames HTML Colorpicker HTML Character Sets HTML ASCII HTML ISO-8859-1 HTML Symbols HTML URL Encode HTML Lang Codes HTML Status Codes

HTML5
HTML5 Tutorial HTML5 Reference Chinese Version

HTML Tables
Previous Next Chapter

HTML Tables
Apples Bananas Oranges Other 44% 23% 13% 10%

Try it Yourself - Examples


Tables How to create tables in an HTML document. Table borders How to specify different table borders. (You can find more examples at the bottom of this page).

HTML Tables
Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). td stands for "table data," and holds the content of a data cell. A <td> tag can contain text, links, images, lists, forms, other tables, etc.

Table Example
<table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table>

How the HTML code above looks in a browser:


row 1, cell 1 row 1, cell 2 row 2, cell 1 row 2, cell 2

HTML Tables and the Border Attribute


If you do not specify a border attribute, the table will be displayed without borders. Sometimes this can be useful, but most of the time, we want the borders to show. To display a table with borders, specify the border attribute:
<table border="1"> <tr> <td>Row 1, cell 1</td> <td>Row 1, cell 2</td> </tr> </table>

HTML Table Headers


Header information in a table are defined with the <th> tag.

All major browsers display the text in the <th> element as bold and centered.
<table border="1"> <tr> <th>Header 1</th> <th>Header 2</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table>

How the HTML code above looks in your browser:


Header 1 Header 2

row 1, cell 1 row 1, cell 2 row 2, cell 1 row 2, cell 2

More Examples
Tables without borders How to create tables without borders. Table headers How to create table headers. Table with a caption How to add a caption to a table.

Table cells that span more than one row/column How to define table cells that span more than one row or one column. Tags inside a table How to display elements inside other elements. Cell padding How to use cellpadding to create more white space between the cell content and its borders. Cell spacing How to use cellspacing to increase the distance between the cells. The frame attribute How to use the "frame" attribute to control the borders around the table.

HTML Table Tags


Tag <table> <th> <tr> <td> Description Defines a table Defines a table header Defines a table row Defines a table cell

<caption> Defines a table caption <colgroup> Defines a group of columns in a table, for formatting <col /> <thead> <tbody> <tfoot> Defines attribute values for one or more columns in a table Groups the header content in a table Groups the body content in a table Groups the footer content in a table

Previous Next Chapter

Harvest Painless Time Tracking


Keep track of development time easily with Harvest. Start a timer from your web browser, desktop or mobile device in seconds. Get started with a free 30-day trial today.

Build Your Professional HTML Website with Wix


Start building your own beautiful website. Its easy and free! Wix.com provides an easy-to-use online platform where you can create and publish your own website. Enjoy powerful drag & drop editing tools & customizable website designs. With total design control, eCommerce features, superior SEO results and free domains, Wix is the ultimate solution for creating your perfect and exquisite HTML website. Over 20 million users have created their website with Wix. Create yours now!

Вам также может понравиться