London
London is the capital city of England
1. HTML stands for Hyper Text Markup Language
2. HTML is the standard markup language for creating Web pages
3. HTML describes the structure of a Web page
4. HTML consists of a series of elements
5. HTML elements tell the browser how to display the content
6. HTML elements label pieces of content such as "this is a heading", "this is a paragraph", "this is a link", etc.
| Start Tag | Element Content | End Tag |
|---|---|---|
<h1> |
My first heading | </h1> |
<p> |
My first paragraph | </p> |
<div> |
My first div | </div> |
| Tag | Description |
|---|---|
<html> |
Defines the root of an HTML document |
<body> |
Defines the document's body |
<h1> to <h6> |
Defines the HTML headings |
<h1 style = "background-color:DodgerBlue;">This is dodger blue</h1><p style = "background-color:Tomato;">This is Tomato</p>This is Tomato
<h1 style = "background-color:Tomato;">This is tomato</h1><p style = "color:DodgerBlue;">This is dodger blue</p><p style = "color:MediumSeaGreen;">This is medium sea green</p>This is dodger blue
This is medium sea green
<a> tag defines a hyperlink. It has the following syntax:<a href = "url">link text</a>
<a href = "url" target = "_blank">link text</a>
<img src = "image.jpg" alt = "My Image">
<body style = "background-image: url('image.jpg');">
<body style = "background-image: url('image.jpg'); background-repeat: repeat;">background-size: cover;background-size: 100% 100%;
<table class = "table">
<colgroup>
<col align="center"/>
<col span="2" />
</colgroup>
<tr>
<th>Company</th>
<th>Contract</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
| Company | Contract | Country |
|---|---|---|
| Alfreds Futterkiste | Maria Anders | Germany |
| Centro comercial Moctezuma | Francisco Chang | Mexico |
<td> element<td> element<td> and </td> tags<td> and </td> are the content of the table cell<tr> element<tr> element <th> element <th> element stands for table header| Tag | Description |
|---|---|
<table> |
Defines a table |
<tr> |
Defines a row in a table |
<th> |
Defines a "header cell" / "cell" in a table |
<td> |
Defines a "cell" in a table |
<thead> |
Groups the header content in a table |
<tbody> |
Groups the body content in a table |
<tfoot> |
Groups the footer content in a table |
<caption> |
Defines a table caption |
<colgroup> |
Groups a set of columns in a table for formatting |
<ul>
<li>Milk</li>
<li>Eggs</li>
<li>Bread</li>
</ul>
<ul> tag<ol> tag<ul> into <ol> in the example<dl> tag defines the description list, <dt> tag defines the term (name), <dd> tag describes each term
<ul>
<li>Milk</li>
<li>Eggs</li>
<li>Bread</li>
</ul>
<dl>
<dt>Computer</dt>
<dd>A machine for calculating</dd>
<dt>Mouse</dt>
<dd>A computer input device</dd>
</dl>
| Tag | Description |
|---|---|
<ul> |
Defines an unordered list |
<ol> |
Defines an ordered list |
<li> |
Defines a list item |
<dl> |
Defines a description list |
<dt> |
Defines a term/name in a description list |
<dd> |
Defines a description of a term/name in a description list |
<class> <class> attribute is used to specify a class for an HTML element
<head>
<style>
.city {
color: white;
background-color:tomato;
border: 2px solid black;
padding: 20px;
margin: 20px;
}
</style>
</head>
<body>
<div class="city">
<h2>London</h2>
<p>London is the capital city of England</p>
</div>
London is the capital city of England
<span> as it will be styled
<h2>My <span class="note">Important</span> Heading</h2>
<id><id> attribute is used to specify a unique id for an HTML element
<head>
<style>
#city {
color: white;
background-color:tomato;
border: 2px solid black;
padding: 20px;
margin: 20px;
}
</style>
</head>
<body>
<div id="city">
<h2>London</h2>
<p>London is the capital city of England</p>
</div>
London is the capital city of England
A class name can be used by multiple HTML elements, while an
id
name must only be used by one HTML element within the page:
<head>
<style>
.city {
color: white;
background-color:tomato;
border: 2px solid black;
padding: 20px;
margin: 20px;
}
#myHeader{
background-color:lightblue;
color: black;
padding: 40px;
text-align: center;
}
</style>
</head>
<body>
<div id="myHeader">My Cities</div>
<div class="city">
<h2>London</h2>
<p>London is the capital city of England</p>
</div>
<div class="city">
<h2>Paris</h2>
<p>Paris is the capital city of France</p>
</div>
London is the capital city of England
Paris is the capital city of France
<div> and <span><form>, <table> and <article><section> element defines a section in a document<article> element specifies independent, self-contained content
<head>
<style>
#myHeader{
background-color:lightblue;
color: black;
padding: 40px;
text-align: center;
}
#mySection{
background-color:lightgreen;
color: black;
padding: 40px;
text-align: center;
}
</style>
</head>
<body>
<div id="myHeader">My Cities</div>
<section id="mySection">
<article>
<h2>London</h2>
<p>London is the capital city of England</p>
</article>
<article>
<h2>Paris</h2>
<p>Paris is the capital city of France</p>
</article>
</section>
London is the capital city of England
Paris is the capital city of France