HTML
INDEX
- <html>
- <head>
- <meta>
- <body>
- <h1> - <h6> for heading
- <hr> for horizontal line
- <p> for paragraph
- <pre> to preserve line breaks
- Formatting Tags
- Quotations
- HTML color
- HTML & CSS
- <a> For links
- <img> For images
- <table> For tables
- HTML Lists
- HTML Forms
<html>
Attributes:
lang="language"- Specifies language used in the document. Example lang=”en-US”.
<head>
Contains title, style, script, meta informations of a page.
<meta>
This tag can only go inside <head> tag. It contains meta data of an HTML page.<meta> tag has no ending tag.
Attributes:
charset="charset"- Describe the character encoding used in the document. Eg. UTF-8.name="type"- Describe different information about the document. types for name can beapplication-nameauthordescriptionkeyword- Keywords about the page. Useful for search engines.viewport- Describe how the page will be shown in different devices. Very useful for portability.
http-equiv="type"- Provieds an HTTP header for the information of the content attribute. type can be:refresh- To set refresh time of a page.
content="value"- Hold values for different types specified inname/http-equivattribute.
Examples:
1 | <!-- Define keywords for search engines --> |
<body>
Attributes:
alink="color"- color of a link when it is clicked.link="color"- color of unvisited link.vlink="color"- color of visited link.background="image.png"- background image of a page if bgcolor not set.bgcolor="color"- background color of a page if background image not set.text="color"- color of the texts in the page.
<h1> to <h6>
Creates headlines in html document.
<hr>
Creates a horizontal line. Used for styling the document.
Attributes:
align- Specifies alignment.size="pixel"- Specifies height in pixel. Eg. size=”10”width="x%"- Specifies width in %. Eg. width=”50%”- noshed - Line will be of a solid color.
<p>
Creates a paragraph. Omit any line breaks(extra space, tab etc).
<pre>
Use fixed width font. Preserve line breaks.
Formatting Tags
<b>- Bold Text.<i>- Italic Text.<u>- Underline.<strong>- Strong Text.<em>- Emphasized Text.<small>- Samll Text.<sup>- Superscript.<sub>- Subscript.<mark>- Marked Text. Text with some background color.<del>- Deleted Text. Striked.<ins>- Inserted Text. Underlined.
Quotations
Quoting with quotation mark
Texts under <q> tag are placed under quotation mark.
Quoting using <blockquote>
<blockquote> is used to quote text from another source.
Text under <blockquote> are indented.
1 | <p>Here is some information about Themis:</p> |
<abbr> for Abbreviation
<abbr> is used for abbreviation. Show full form under cursor.
1 | <p> |
<address> for Contact Information
1 | <address> |
<cite>
<cite> is used for mentioning the title of someone’s work.
1 | <p><cite>Star Wars</cite> directed by George Lucas</p> |
HTML Color
Color can be specified in three way.
- Using color name. List of standard color names
1
<p style="color: red">This is a red text</p>
- Using RGB value.
1
<p style="color: rgb(0, 255, 0)">This is a green text</p>
- Using hexadecimal value.
1
<p style="color: #808080">This text is Ass</p>
CSS And HTML
CSS is used for decoration. Three ways to use CSS in HTML.
Inline CSS
Inline CSS is used to decorate each tag individualy using the style attribute.
1 | <p style="font-family: garamond; color: red;">We want freedom in the web</p> |
Internal CSS
Internal CSS is used to decorate the whole HTML document. <style> tag in used
inside <head> to decribe CSS properties.
1 |
|
To identify each tag separately id and class can be used.
HTML id Example
1 |
|
HTML class Example
1 |
|
Extarnal CSS
Separate CSS file is used. <link> tag is used to use the file in the document.
1 | <head> |
<a> for Links
See W3Schools.
<img> for Images
See W3Schools. Some interesting features:
- Floating property
<map>tag.
<table> for Tables
See W3Schools. Example:
1 | <table style="width:100%"> |
HTML Lists
See W3Schools. Interesting:
- Description List.
- Creating a Menu using list and CSS.
HTML Form
For creating HTML forms for getting data from user.
Froms are created using <form></form> tag. Forms normaly contains:
<input>- Creating various types of inputs. Text, button, radio button, checbox etc.<select>- For creating a drop down list.<textarea>- For creating a large text field.<label>- For creating label for various inputes.<fieldset>- For specifying different input group.<legend>tag is used for labeling<fieldset>.
Important Attributes:
action="process_file_address"- Specifies the sever side sript which will process the submitted data.method="get/post"-getfor plain text submit.postfor encrypted submit.name="form_name"- Specifies the name of the form.id=""- ID of the form.autocomplete="on/off"- Turn on/off browser autocomplete feature.enctype=""- Specifies how the data will be encrypted when send to the server.accept="file_type"- Specifies comma separated file types that will be allowed for upload.target=""- Specifies where submit response will be shown(New tab, own page etc).
<input> for various types of input area
In type attribute input types are specified.
It can be:
type="text"- For simple text area.type="password"- For taking passwords.type="radio"- For radio buttons.type="checkbox"- For checkbox.type="file"- For uploading file.type="button"- Creating a button. When the button is clicked it works based ononclick="scrpit_to_execute"attribute.type="submit"- Creates a submit button for the form. When the submit button is clicked action is taken based on theactionattribute of the form.type="reset"- Creates a button for resetting the form.type="image"- Defines an image as a submit button.type="range"- Creates a range slider.type="number"- Creates a number picker.type="color"- Creates a color picker.type="date"- Creates a date picker.type="tel"- Telephone number form.
Important Attributes:
name=""- Specifies the name of an<input/>element.value=""- Specifies the value of an<input>element. This can be used for setting default value.placeholder=""- This text is shown faded in the text fields.size=""- Maximum character input size for an input field.max=""- Maximum accepted value for number, range, date type.min=""- Minimum accepted value for number, range, date type.step=""- Step size for slider or number picker.pattern=""- Specifies a regular expression against which input is validated.title=""- Text that is show when input dont pass regex validation.autocomplete="on/off"- on/off browser autocomplete feature.autofocus="on/off"- Will autofocus to this input field when the page loads.checked- Make a checkbox / radio button as checked.disabled- To disable an input field.multiple- User can enter multiple values in an input element.readonly- Specifies a input field as readonly. It can’t be changed.required- Specifies a field as required.accept="file_type1, file_type2"- Accepted file types. Comma separated for multiple file type acceptence.formaction=""- Specifies the script that will process this input field when the form submitted.formmethod="get/post"- Which method to follow for form submission.formenctype=""- Submitted data encryption type.formtarget=""- Specifies where the response will be placed for this input(New tab, own page etc).
Example of an HTML form with all the tags and attributes
1 |
|