<p>
I am a paragraph tag - the workhorse of the web.
</p>
I am a paragraph tag - the workhorse of the web.
Most text content is comprised of paragraphs, and most of the web is text; therefore, p elements are the workhorse of the web. But don’t overuse them! Try to use them only for actual paragraphs of text. (If you’re just looking for a generic block container, then try div instead.)
<h1>Top-most heading</h1>
<h2>Second-level heading</h2>
<!-- etc -->
<h6>The last level</h6>HTML offers six levels of headings — h1 through h6. Choose one based on the correct semantic level of hierarchy — is it the top-level heading of the page? the secondary heading? tertiary?
Don’t choose based on the default style (size, weight) that the browser assigns — we’re going to override those awful default styles anyway.
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Evolution_of_a_Tornado.jpg/1024px-Evolution_of_a_Tornado.jpg">
Produces:
![]()
Click <a href="https://www.google.com/">here</a> to search.Produces:
Click here to search.
If you want the link to open in a new tab, add the target="_blank" attribute:
Click <a href="https://www.google.com/" target="_blank">here</a>
to search but not leave us.Produces:
Click here to search but not leave us.
For simple lists, you have two choices: ul (unordered) or ol (ordered) lists.
Use ul if the items have no particular order. Use ol if the items are ordered.
By default, the browser will use bullets before each item in a ul and will automatically number each item in an ol (starting with 1). We can and will overwrite these default styles; most of the time we don’t want bullets at all. So choose ul or ol based on the semantics of the list, not on bullets.
Nested within the ul or ol should come one or more li elements that contain the actual items in the list.
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
</ul>
Produces:
<ol>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
</ol>
Produces:
When you have a list of things along with a label for each thing, a dl (definition list) might fit the bill. Each label goes in a dt (definition term), and each piece of data goes in a dd tag (definition description).
<dl>
<dt>First name</dt>
<dd>Raghu</dd>
<dt>Last Name</dt>
<dd>Betina</dd>
<dt>Role</dt>
<dd>Instructor</dd>
</dl>
Produces →
In HTML, the <table> element is used to represent two-dimensional, tabular data. A simple table looks like this:
<table border="1">
<tr>
<td>First</td>
<td>Last</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
</tr>
</table>
Produces →
| First | Last |
|---|---|
| John | Doe |
| Jane | Doe |
| First | Last |
|---|---|
| John | Doe |
| Jane | Doe |
The things to keep in mind about tables are:
<td> (table data) element.<td> element must reside within a row, a <tr> element.<tr> must have the same number of cells, or things get out of whack.Despite this last rule, you can, however, “merge” cells using the colspan attribute:
<table border="1">
<tr>
<td colspan="2">People</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
</tr>
</table>
| People | |
| John | Doe |
| Jane | Doe |
Produces →
You can see that we’ve merged two cells in the first row together; the colspan="2" on the first cell ensures that we don’t violate the “every <tr> must have the same number of cells” rule.
Regular text
<div>
Block level <a href="https://google.com">element</a>
</div>
The div tag defines a division or a section in an HTML document. Similar to a p tag, but it should be used to contain or group together other tags, not just text.
My mother has <span>brown</span> eyes
The span tag is used to group inline-elements in a document. It provides no visual change by itself. It's most commonly used to style or select a specific part of text.
<!DOCTYPE html>
The doctype is the required "<!DOCTYPE html>" preamble found at the top of all documents. It instructs the web browser about what version of HTML the page is written in. It must be the very first thing in your HTML document, before the html tag.
<!DOCTYPE html>
<html>
</html>
The html tag tells the browser that this is an HTML document. It is used as a container for all of the HTML of an entire document or page. (except for the <!DOCTYPE> declaration).
<!DOCTYPE html>
<html>
<head>
</head>
</html>
The head tag contains information about an HTML document that is used by browsers and web crawlers but is not displayed to website visitors. The head is where you put information like the page title, the character selection, or link to your site's Favicon.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This is a whole HTML page.
</body>
</html>
The body tag contains the entire content of a webpage. It must be the second element inside of the parent html element, following only the head element. Any text, links images, list, or tables go inside the body.
This is a whole HTML page.
<!DOCTYPE html>
<html>
<head>
<title>HTML Reference</title>
</head>
<body>
This is a whole HTML page.
</body>
</html>
The title tag is required and used to assign a title to an HTML document. These titles are not displayed in the browser window, but they are used as the page name by search engines and displayed by browsers in the title bar, on the page tab, and as the page name of bookmarked webpages.
This is a whole HTML page.
<!DOCTYPE html>
<html>
<head>
<title>HTML Reference</title>
<meta charset="utf-8">
<meta name="author" content="John Doe">
</head>
<body>
This is a whole HTML page.
</body>
</html>
The meta tag is used to add machine-readable information to an HTML page. These tags always go in the head tag and are typically used to specify information about the content of the page. For example, page description, keywords, author of the document, or type of characters used.
This is a whole HTML page.
<!DOCTYPE html>
<html>
<head>
<title>HTML Reference</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="theme.css">
</head>
<body>
This is a whole HTML page.
</body>
</html>
The link tag defines a link between a document and an external resource. This element is most commonly used to define the relationship between a document and one or more external CSS stylesheets.
This is a whole HTML page.