-
DOCTYPE Declaration for HTML 5
<!DOCTYPE html>
-
DOCTYPE Declaration for HTML 4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
-
HTML Page Structure
- <!DOCTYPE html>
- <html>
- <head></head>
- <body></body>
- </html>
-
This tag defines a title in the browser toolbar, provides a title for the page when it is added to favorites, and displays a title for the page in search-engine results:
- <head>
- <title></title>
- </head>
-
This tag specifies the base URL/target for all relative URLs in a page:
-
This tag defines the relationship between a document and an external resource:
-
This tag is used to define style information for an HTML document:
<style></style>
-
This tag is used to provide metadata about the HTML document:
-
This tag is used to define a client-side script, such as JavaScript:
<script></script>
-
These elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata:
meta elements
-
HTML link syntax with target attribute
<a href="url"target="_blank"></a>
-
Create a bookmark and link to that bookmark inside an HTML document.
- <a id="info">Information</a>
- <a href="#info">For further information</a>
-
This element is the container for all the head elements.
<head></head>
-
CSS can be added to HTML in the following ways:
- Inline - using the style attribute in HTML elements
- Internal - using the <style> element in the <head> section
- External - using an external CSS file
-
Inline style example
<p style="color:blue;margin-left:20px;">This is a paragraph.</p>
-
Internal style sheet example
- <head>
- <style type="text/css">
- body {background-color:yellow;}
- p {color:blue;}
- </style>
- </head>
-
External style sheet example
- <head>
- <link rel="stylesheet" type="text/css" href="mystyle.css"/>
- </head>
-
Syntax for defining an image:
<img src="url" alt="some_text"/>
-
Image definition with alt, height, and width defined
<img src="smiley.gif" alt="Smiley face" width="32" height="32"/>
-
Table example with border and header attributes
- <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>
- </table>
-
Unordered List Example
- <ul>
- <li>Coffee</li>
- <li>Milk</li>
- </ul>
-
Ordered List Example
- <ol>
- <li>Coffee</li>
- <li>Milk</li>
- </ol>
-
Description List Example
- <dl>
- <dt>Coffee</dt>
- <dd>- black hot drink</dd>
- <dt>Milk</dt>
- <dd>- white cold drink</dd>
- </dl>
-
This list tag defines an ordered list:
<ol></ol>
-
This list tag defines an unordered list:
<ul></ul>
-
This list tag defines a list item in an ordered or unordered list:
<li></li>
-
This list tag defines a description list:
<dl></dl>
-
This list tag defines a term/name in a description list:
<dt></dt>
-
This list tag defines a description of a term/name in a description list:
<dd></dd>
-
This type of element normally starts (and ends) with a new line when displayed in a browser.
Block element
-
This type of element is normally displayed without starting a new line.
Inline element
-
This block level element can be used as a container for grouping other HTML elements.
<div></div>
-
This inline element can be used as a container for text.
<span></span>
-
For what are HTML forms used?
To pass data to a server
-
Form element syntax
- <form>
- .
- input elements
- .
- </form>
-
Text field example
- <form>
- First name: <input type="text" name="firstname"/><br/>
- Last name: <input type="text" name="lastname"/>
- </form>
-
Password field example
- <form>
- Password: <input type="password" name="pwd"/>
- </form>
-
Radio button example
- <form>
- <input type="radio" name="sex" value="male"/>Male<br>
- <input type="radio" name="sex" value="female"/>Female
- </form>
-
Checkbox example
- <form>
- <input type="checkbox" name="vehicle" value="Bike"/>I have a bike<br>
- <input type="checkbox" name="vehicle" value="Car"/>I have a car
- </form>
-
Submit button example
- <form name="input" action="html_form_action.asp" method="get">
- Username: <input type="text" name="user"/>
- <input type="submit" value="Submit"/>
- </form>
-
Drop-down list example
- <form action="">
- <select name="cars">
- <option value="volvo">Volvo</option>
- <option value="saab">Saab</option>
- </select>
- </form>
-
Drop-down list with pre-selected value example
- <form action="">
- <select name="cars">
- <option value="volvo">Volvo</option>
- <option value="saab" selected>Saab</option>
- </select>
- </form>
-
Textarea example
- <textarea rows="10" cols="30">
- The cat was playing in the garden.
- </textarea>
-
Button example
- <form action="">
- <input type="button" value="Hello world!"/>
- </form>
-
Create a border around elements in a form.
- <form action="">
- <fieldset>
- <legend>Personal information:</legend>
- Name:<input type="text" size="30"/><br>
- E-mail: <input type="text" size="30"/><br>
- Date of birth: <input type="text" size="10"/>
- </fieldset>
- </form>
-
Send e-mail from a form.
- <form action="MAILTO:someone@example.com" method="post" enctype="text/plain">
- Name:<br>
- <input type="text" name="name" value="your name"/><br>
- <input type="submit" value="Send"/>
- <input type="reset" value="Reset"/>
- </form>
-
Syntax for adding an iframe
<iframe src="url"></iframe>
-
Iframe - Set Height and Width
<iframe src="demo_iframe.htm" width="200"height="200"></iframe>
-
Iframe - Remove the Border
<iframe src="demo_iframe.htm" frameborder="0"></iframe>
-
Use iframe as a Target for a Link
- <iframe src="demo_iframe.htm" name="iframe_a"></iframe>
- <p><a href="http://www.w3schools.com" target="iframe_a">W3Schools.com</a></p>
-
This tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesn't support client-side scripting.
<noscript></noscript>
-
With what must reserved characters in HTML be replaced?
Character entities
-
URL Structure
scheme://host.domain:port/path/filename
-
URLs can only be sent over the Internet using:
The ASCII character-set
-
Table with caption example:
- <table border="1">
- <caption>Monthly Savings</caption>
- <tr>
- <th>Month</th>
- <th>Savings</th>
- </tr>
- <tr>
- <td>January</td>
- <td>$100</td>
- </tr>
- </table>
-
Javascript example:
- <script>
- document.write("Hello World!")
- </script>
-
Image map example:
<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
- <map name="planetmap">
- <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm"/>
- </map>
-
Table cells that span more than one row:
- <table border="1">
- <tr>
- <th>First Name:</th>
- <td>Bill Gates</td>
- </tr>
- <tr>
- <th rowspan="2">Telephone:</th>
- <td>555 77 854</td>
- </tr>
- <tr>
- <td>555 77 855</td>
- </tr>
- </table>
-
Table cells that span more than one column:
- <table border="1">
- <tr>
- <th>Name</th>
- <th colspan="2">Telephone</th>
- </tr>
- <tr>
- <td>Bill Gates</td>
- <td>555 77 854</td>
- <td>555 77 855</td>
- </tr>
- </table>
-
Create more white space between the cell content and its borders in a table using:
- The cellpadding attribute.
- <table border="1" cellpadding="10">
-
Increase the distance between the cells in a table using:
- The cellspacing attribute.
- <table border="1" cellspacing="10">
-
Different types of unordered lists:
- <ul>
- <ul style="list-style-type:disc">
- <ul style="list-style-type:circle">
- <ul style="list-style-type:square">
-
Different types of ordered lists:
- <ol>
- <ol type="A">
- <ol type="a">
- <ol type="I">
- <ol type="i">
-
A nested List:
- <ul>
- <li>Coffee</li>
- <li>Tea
- <ul>
- <li>Black tea</li>
- <li>Green tea</li>
- </ul>
- </li>
- <li>Milk</li>
- </ul>
|
|