Showing posts with label Tutorial. Show all posts
Showing posts with label Tutorial. Show all posts

Friday, 1 May 2015

Bootstrap Website

Creating a website with Bootstrap is easy and fun. If you know HTML and CSS or have a basic knowledge to code them, then you wont have much a problem to code in Bootstrap. Bootstrap used both HTML and CSS properties for designing. It commonly uses the HTML5 doctype.

You should always remember to put the HTML5 doctype declaration and also the lang attribute at the starting of the webpage.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
Body content......
</body>
</html>
Bootstrap is mainly used to create mobile responsive web pages. The good point is that you don't have to view the same big desktop page in your mobile. You don't have always minimize and maximize anytime you want to click a link or view the text. Mobile-first styles are actually a part of the Bootstrap core framework. But in order to get proper mobile rendering you have to add the following meta code in the head section.

<meta name="viewport" content="width=device-width, initial-scale=1">
  • "width=device-width" - This part sets the width of the page to follow the width of the device.
  • "initial-scale=1" - This sets the initial zoom level when the page is first loaded.
Bootstrap also requires a container to wrap site contents. But remember that you cannot put one container inside another. There are mainly two container classes.
  • ".container" - This provides with a fixed width responsive container.
  • ".container-fluid" - This provides with a full width container spreading across the entire width of the viewport.
Container
For Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h1>My Bootstrap Webpage</h1>
<p>I love learning Bootstrap.</p>
</div>
</body>
</html>
Container-Fluid
For Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<h1>My Bootstrap Webpage</h1>
<p>I love learning Bootstrap.</p>
</div>
</body>
</html>

CSS Links

Links are found in every document. Links are used to click their way from one page to another page. With CSS, we can style links to make them decorative and colorful.

Styling Links

Links can be styled with any CSS property such as color, font-family, background etc. In addition, links can be styled differently depending on what state they are in.

The four link states are:
  • a:link - a normal link, or an unvisited link
  • a:visited - a link that the user had visited
  • a:hover - a link when the user mouses over it
  • a:active - a link at the moment it is clicked
For example:
a:link {color:#FF0000;}
a:visited {color:#00FF00;}
a:hover {color:#FF00FF;}
a:active {color:#0000FF;}

Text Decoration

The text-decoration property is mainly used to remove the underline from the links.

For example:
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:underline;}

Background Color

The background-color property is used to specify background color for the links.

For example:
a:link {background-color:#0000FF;}
a:visited {background-color:#FF00FF;}
a:hover {background-color:#00FF00;}
a:active {background-color:#FF0000;}

HTML Forms

HTML Forms are used to create different kinds of user inputs.

HTML <form> Tag

HTML <form> tag is used create an HTML form to pass user inputs and data to the server. AN HTML form can contain input elements like text fields, checkbox, radio-buttons, submit-buttons, and more. A form can also contain select lists, textarea, fieldset, and label elements.

The <form> elemts can contain one or more of the following elements.
  • <input>
  • <textarea>
  • <button>
  • <select>
  • <option>
  • <optgroup>
  • <fieldset>
  • <label>
For example:
<form action="form.asp" method="get">
First name: <input type="text" name="fname">
Last Name: <input type="text" name="lname">
<input type="submit" value="Submit">
</form>

HTML <input> Tag

The most important form element is the input element. The <input> element is used to select user information. It specifies an input field where the user can enter data. The input element can vary in different ways, depending on the type attribute. It can be of text types, checkbox, password, radio button, submit button and more.

Text Fields
The text fields are used to create a one-line input field to enter text into.

For example:
<form>
First name: <input type="text" name="fname">
Last Name: <input type="text" name="lname">
</form>
Password Field
The password field are used to create a one-line input field to enter the password. The characters inside the password field are masked that is, it will be shown as asterisks or circles.

For example:
<form>
Password: <input type="password" name="pwd">
</form>
Radio Button
The radio buttons are used to create a radio button which allows the user to select only one of a limited number of choices.

For example:
<form>
<input type="radio" name="sex" value="male">Male
<input type="radio" name="sex" value="female">Female
</form>
Checkboxes
The checkbox are used to create checkboxes that allows the user to select multiple number of options of a limited number of choices.

For example:
<form>
<input type="checkbox" name="web" value="HTML">Hyper Text Markup Language
<input type="checkbox" name="web" value="CSS">Cascading Style Sheets
</form>
Submit Button
A submit button is used to send form data into the server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute does some action the data it receives.

For example:
<form>
First name: <input type="text" name="fname">
Last Name: <input type="text" name="lname">
<input type="submit" value="Submit">
</form>

HTML <textarea> Tag

The <textarea> tag is used to define a multi-line text input control. A text area can hold an unlimited number of characters, and the text is rendered in a fixed-width font. The size of the textarea can be specified by the cols and rows attributes, or using CSS height and width properties.

For example:
<textarea rows="4" cols="20">
The <textarea> tag is used  to define a multi-line text input control.
 The size of the textarea can be specified by the cols and rows attributes 
 or using CSS height and width properties.
<textarea>

HTML <label> Tag

The <label> tag defines a label for an <input> element. The <label> tag does not render as anything special for the user. However, it provide a usability improvement for mouse users, because if the user clicks on the text within the <label> element, it toggles the control.

For example:
<form>
<label for="male">Male</label>
<input type="radio" name="sex" id="male" value="male">
<label for="female">Female</label>
<input type="radio" name="sex" id="female" value="female">
</form>

HTML <fieldset> Tag

The <fieldset> tag is used to group related elements in a form. It draws a box around the related elements.

For example:
<form>
<fieldset>
<legend>Personalia:</legend>
Name: <input type="text" size="30">
Email: <input type="text" size="30">
</fieldset>
</form>

HTML <legend> Tag

The <legend> tag is used to specify a caption for the fieldset element.

For example:
<form>
<fieldset>
<legend>Personalia:</legend>
Name: <input type="text" size="30">
Email: <input type="text" size="30">
</fieldset>
</form>

HTML <select> Tag

The <select> tag is used to create a drop-down list.

For example:
<select>
<option value="HTML">HTML</option>
<option value="CSS">CSS</option>
<option value="JavaScript">JavaScript</option>
<option value="jQuery">jQuery</option>
</select>

HTML <optgroup> Tag

The <optgroup> tag is used to group related options in a drop-down list. It is used when you have a long list of options, and it helps to group realted options, ehich is easier to handle for a user.

For example:
<select>
<optgroup label="Designing">
<option value="HTML">HTML</option>
<option value="CSS">CSS</option>
</optgroup>
<optgroup label="Scripting">
<option value="JavaScript">JavaScript</option>
<option value="jQuery">jQuery</option>
</optgroup>
</select>

HTML <option> Tag

The <option> tag is used to define a option in a drop-down list.

For example:
<select>
<option value="HTML">HTML</option>
<option value="CSS">CSS</option>
<option value="JavaScript">JavaScript</option>
<option value="jQuery">jQuery</option>
</select>

HTML <button> Tag

The <button> tag is used to create a clickable button. Inside the button element, we can put contents like text or images.

For example:
<button type="button">Click Me!</button>

HTML5 <datalist> Tag

The <datalist> tag is used to specify a list of pre-defined options for an input element. The datalist element is used to provide an autocomplete feature on input element. Users can see a drop-down list of pre-defined options as they input data.

For example:
<input list="browsers">
<datalist id="browsers">
<option value="Google Chrome">
<option value="Mozilla Firefox">
<option value="Safari">
</datalist>

HTML5 <keygen> tag

The <keygen> tag specifies a key-pair genator field used for forms. When the form is submitted, the private key is stored locally, and the public key is sent to the server.

For example:
<form action="form.asp" method="get">
Username: <input type="text" name="username">
Encryption: <keygen name="security">
<input type="submit" value="Submit">
</form>

HTML5 <output> tag

The <output> tag represents the result of a calculation.

For example:
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" id="a" value="50">100
+<input type="number" id="b" value="50">
=<output name="x" for="a b"></output>
</form>

Wednesday, 29 April 2015

jQuery Syntax

With jQuery, we can select HTML elements and perform some actions in it.

jQuery Syntax

The jQuery syntax is used to select the HTML elements and perform some action in it.

The Basic Syntax is : $(selector).action()
  • The $ sign is used to define or access jQuery
  • The (selector) is used to find or select HTML elements.
  • The action() is the jQuery action to be performed in the HTML element.
For example:
$("p").hide()

The Document Ready Event

The document ready event is used to prevent any jQuery code from running before the document had finished loading. It is good practice for the document to be loaded before working with it. This also allows you to place the jQuery code before the body of the document, that is in the head section.

For example:
$ (document).ready(function() {
   // jQuery method goes here...
});

The jQuery team has also created an even shorter method for the document ready event.

For example:
$ (function () {
   // jQuery method goes here...
});

Monday, 27 April 2015

HTML Tables

Tables are used to create tabular data that is, data represented in rows and columns. HTML tables are created using the <table> tag in conjunction with the <tr> and <td> tags. Some also use table to represent web layouts.

HTML <table> Tag

The <table> tag is used to create a HTML table. The <table> tag is used in conjunction with the <tr>, <th> and <td> tag to create a table.

For example:
<table>
<tbody>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tbody>
</table>

HTML <tr> Tag

The <tr> tag is used to define a table row in an HTML table. The <tr> tag contains more than one <th> and <td> tags.

For example:
<table>
<tbody>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tbody>
</table>

HTML <th> Tag

The <th> tag is used to create a header cell in HTML tables. The header cell will be bold and centered and also left-aligned by default.

For example:
<table>
<tbody>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tbody>
</table>

HTML <td> Tag

The <td> tag is used to create standard cells in HTML tables. This cell usually contains the data in the table.

For example:
<table>
<tbody>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tbody>
</table>

HTML <caption> Tag

The <caption> tag is used to define a table caption. The <caption> tag is inserted just after the <table> tag. By default, the caption may be center aligned.

For example:
<table>
<caption>WEB DESIGNING</caption>
<tbody>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tbody>
</table>

HTML <thead> Tag

The <thead> tag is used to group the header contents in an HTML table. The <thead> tag is used in conjuction with the <tbody> and <tfoot> to specify each part of the table.

For example:
<table>
<thead>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
</thead>
<tbody>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tfoot>
</table>

HTML <tbody> Tag

The <tbody> tag is used to group the body contents in an HTML table. The <tbody> tag is used in conjuction with the <thead> and <tfoot> to specify each part of the table.

For example:
<table>
<thead>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
</thead>
<tbody>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tfoot>
</table>

HTML <tfoot> Tag

The <tfoot> tag is used to group the footer contents in an HTML table. The tag is used in conjuction with the <thead> and <tbody> to specify each part of the table.

For example:
<table>
<thead>
<tr>
<th>HTML</th>
<th>CSS</th>
</tr>
</thead>
<tbody>
<tr>
<td>Hyper Text Markup Language</td>
<td>Cascading Style Sheets</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>.html</td>
<td>.css</td>
</tr>
</tfoot>
</table>

HTML <colgroup> Tag

The <colgroup> tag is used to specify a group of one or more columns in a table for formatting. The <colgroup> tag is useful to specify styles for an entire column rather than repeating styles for each cell, for each row.

For example:
<table>
<colgroup>
<col span="2" style="background-color: yellow;"></col
<col style="background-color: red;"></col>
</colgroup>
<tbody>
<tr>
<th>HTML</th>
<th>CSS</th>
<th>JavaScript</th>
</tr>
<tr>
<td>Markup Language</td>
<td>Style Sheet Language</td>
<td>Scripting Language</td>
</tr>
<tr>
<td>.html</td>
<td>.css</td>
<td>.js</td>
</tr>
</tbody>
</table>

HTML <col> Tag

The <col> tag is used to specify column properties for each column within a element. The <col> tag is useful to specify styles for an entire column rather than repeating styles for each cell, for each row.

For example:
<table>
<colgroup>
<col span="2" style="background-color: yellow;"></col
<col style="background-color: red;"></col>
</colgroup>
<tbody>
<tr>
<th>HTML</th>
<th>CSS</th>
<th>JavaScript</th>
</tr>
<tr>
<td>Markup Language</td>
<td>Style Sheet Language</td>
<td>Scripting Language</td>
</tr>
<tr>
<td>.html</td>
<td>.css</td>
<td>.js</td>
</tr>
</tbody>
</table>

JavaScript Syntax

Just like all programming language,in JavaScript also, the Syntax defines how to construct the language. It is the principle by which the language is constructed. The sentences of a programming language is called statements.

JavaScript Character Set

JavaScript uses Unicode character set. Unicode cover almost all characters, punctuations, and symbols in the world. Unicode enables processing, storage, and transport of text, independent of platform and language. Unicode can be implemented by different character set. The most commonly used encoding are UTF-8 and UTF-16. A character set contains the following:

  1. Letters: The English alphabets (A to Z and a to z)
  2. Digits: The Numerals (0 to 9)
  3. Special Characters: + - * / \ ! @ # $ % ^ & * ( ) _ - = [ ] { } | ; : " ' , . ? etc
  4. White spaces: Blank Space (Space bar), Tab, Return etc
  5. Other characters: Non-Graphic Symbols.

JavaScript Functions

A function is a block of code designed to perform a particular task. JavaScript statements written inside a JavaScript function, can be invoked many times as the user desires. To invoke a function means to call upon the function or asking up the code in the function which is being called to be executed.

For example:

function myFunction (a, b) {
 return a + b;
}

JavaScript Data Type

JavaScript data types are the data's provided to an variable. It can be anything like number, characters, text string, arrays, objects, and much more. A programming language like JavaScript has to deal with all kinds of data. Data types are defined to differentiate the nature and size of incoming data. JavaScript is flexible enough to allow user to define data types therefore increasing its demand in the programming world.

For example:

var number = 10;
var name = "Edwin";
var language = ["HTML","CSS","JavaScript","jQuery"]

JavaScript Keywords

A JavaScript statement always starts with a keyword. The words that convey a specific meaning to the language compilers are called keywords. These are also known as reserved words as they are reserved by the language for special purpose and cannot be redefined for any other purpose.

abstract else instanceof super
boolean enum int switch
break export interface synchronized
byte extends let this
case false long throw
catch final native throws
char finally new transient
class float null true
const for package try
continue function private typeof
debugger goto protected var
default if public void
delete implements return volatile
do import short while
double in static with

For example:

var x = 5 + 6;
var y = a * b;

JavaScript Identifiers

All programming languages must identify variables, functions, and objects with unique name. These unique names are called identifiers. Identifiers are the user defines words that are used to name different program elements such as memory locations, functions, statements, objects, classes etc. These are the fundamental building blocks of the program. The identifiers of memory locations are called variables; of functions are called function names; of statements are called labels and so on.

JavaScript Literals

Literals are tokens that represent data items that never change their value during the program run. They are often referred to as constants. In programming language, literals are constants. Number literals can be written with or without decimal points, and wit or without scientific notations. String literals can be written with double or single quotes.

For example:

3.14
1001
123e5
"Edwin Ronald Lambert"
'Edwin Ronald Lambert'

JavaScript Operators

Data processing is a sequence of operations. Operators are predefined symbols that can carry out operations. Operators are the token that triggers some kind of operations on the data. The data on which the operations are carried out are called operands. The operands may be either a constant or a variable. Generally operators perform the operations and return some results.

For example:

x = 5;
y = 6;
z = x + y;

JavaScript Statements

JavaScript statements are commands to the browser. It tells the browser what function it has to do. JavaScript ignores spaces, tabs and newlines that appears in a JavaScript program. Because of that, it allows you to format and indent the program in a neat and consistent way that make the code easy to read and understand. Semicolon separates the JavaScript statements. Therefore we add semicolon at the end of each executable statements.

For example:

x = 5 + 6;
y = x * 10;

JavaScript Variables

In JavaScript, variables are the named memory locations capable of storing constants or data. in fact, variables are containers for storing informations or data. A variable can be defined in any data type. The size and nature of data stored in a variable depends on the data type , it is declared. The equal sign assigns a value to a named variable.

For example:

x = 5;
y = 6;
z = x + y;

JavaScript Comments

JavaScript comments are used to explain the code and make the code more readable. It can also be used to prevent execution during testing alternative codes.

For example:

//This is a single line comment. I will not be executed.

/*
This is a double line comment.
I will not be executed.
*/

Sunday, 26 April 2015

JavaScript Statements

WebLearn Tech

A JavaScript consist of statements that are placed inside the <script> and </script> HTML tags. The <script> tag tells the browser that everything inside the tag is a script. In HTML, JavaScript is a sequence of statements that can be executed by a web browser.

JavaScript Statements

JavaScript statements are commands to the browser. It tells the browser what function it has to do. JavaScript ignores spaces, tabs and newlines that appears in a JavaScript program. Because of that, it allows you to format and indent the program in a neat and consistent way that make the code easy to read and understand. Semicolon separates the JavaScript statements. Therefore we add semicolon at the end of each executable statements.

JavaScript Code

JavaScript code is a sequence of JavaScript statements. Each statement is executed by the browser in the sequence they are written. JavaScript code can be grouped together in blocks. A block starts with the left curly bracket and ends with the right curly bracket. The purpose of the block is to make the sequence of the statement execute together. You can break up the code using a backslash within the text string.

For example:

<!DOCTYPE html>
<html>
<body>

<h1>My Web Page</h1>
<p id="myPar">This is a paragraph</p>
<div id="myDiv">This is a Div</div>
<p><button type="button" onclick="myFunction()">Try it</button></p>

<script>
function myFunction()
{
document.getElementById("myPar").innerHTML="Hello World!";
document.getElementById("myDiv").innerHTML="How are you?";
}
</script>

</body>
</html>

JavaScript Identifiers

All programming languages must identify keyords, variables, methods, properties and labels with unique names. In JavaSript, these unique names are called identifiers. In JavaScript, these identifiers should begin with a letter, or an underscore (_) or a dollar sign ($). The other characters can be letters, digits, underscore or dollar sign. Some JavaScript identifiers are reserved as keywords and cannot be used as identifiers in a script.

JavaScript is case Sensitive

JavaScript is Case Sensitive. All identifiers, keywords, variables, methods, properties, and functions are case sensitive. A variable named myVariable is different from MyVariable, also the function getElementById is different from getElementbyID.

Saturday, 25 April 2015

CSS List

WebLearn Tech

The CSS List property allows you to set different list item markers for ordered and unordered list. In HTML, there are two kinds of list, unordered list and ordered list. With CSS, it can be styled further and images can be used as lists.

List Style

The list-style property is used to set all list styles in one declaration. The properties are in the order: list-style-type, list-style-position, list-style-image.

For example:

<!DOCTYPE html>
<html>
<head>
<style>
ul
{
list-style:square url('square.gif');
}
</style>
</head>

<body>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ul>
</body>
</html>

List Style Image

The list-style-image property replaces the list-item marker with an image.

For example:

<!DOCTYPE html>
<html>
<head>
<style>
ul
{
list-style-image:url('square.gif');
}
</style>
</head>

<body>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ul>
</body>
</html>

List Style Position

The list-style-position property is used to specify if the list item markers should appear inside or outside of the content flow.

For example:

<!DOCTYPE html>
<html>
<head>
<style>
ul.a {list-style-position:inside; }
ul.b {list-style-position:outside; }
</style>
</head>

<body>
<p>The following list has the list-style-position inside:</p>
<ul class="a">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ul>

<p>The following list has the list-style-position outside:</p>
<ul class="b">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ul>
</body>
</html>

List Style Type

The list-style-type property is used to specify the type of list-item in a list.

For example:

<!DOCTYPE html>
<html>
<head>
<style>
ul.a {list-style-type:circle; }
ul.b {list-style-type:square; }
ol.c {list-style-type:upper-roman; }
ol.d {list-style-type:lower-alpha; }
</style>
</head>

<body>
<p>Example of unordered lists:</p>

<ul class="a">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ul>

<ul class="b">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ul>

<p>Example of ordered lists:</p>

<ol class="c">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ol>

<ol class="d">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>jQuery</li>
</ol>

</body>
</html>

HTML Sections

HTML elements can be grouped together for various content. Some of the common used tags are <div> and <span>. We can use <div> to display the header section or footer section. But, in HTML5, new tags such as <nav>, <header>, <footer> reduce the tag consumption used in <div> element.

HTML <div> Tag

The <div> tag is used as a block level element that can be used as a container for grouping other HTML elements. The <div> tag has no special meaning, except that it displays a line break before and after the tag. When used with CSS, it can be styled to our desire. It is also used to describe web page layouts.

For example:
<div>
<h1>This is a heading</h1>
<p>This is a paragraph</p>
</div>

HTML <span> Tag

The <span> tag is an inline element that can be used as a container for text. When used with CSS, it can be used to style the text.

For example:
My friend has <span style="color: brown">brown</span&gt: eyes.

HTML5 <header> Tag

The <header> tag is used to specify the header of the document or section. It should be used as the container for introductory contents.

For example:
<header>
<h1>HTML</h1>
<p>HTML means Hyper Text Markup Language</p>
</header>

HTML5 <section> Tag

The <section> tag id used to define a section in a document. A section is a used for grouping of content, typically with a heading.

For example:
<section>
<h1>HTML</h1>
<p>HTML means Hyper Text Markup Language</p>
</section>

HTML5 <article> Tag

The <article> tag is used to specify independent, self-contained content. An article should make sense on its own and it should be possible to distribute it independently.

For example:
<article>
<h1>HTML</h1>
<p>HTML means Hyper Text Markup Language</p>
</article>

HTML5 <aside> Tag

The <aside> tag is used to specify some content aside from the content it is placed in.

For example:
<aside>
<h1>HTML</h1>
<p>HTML means Hyper Text Markup Language</p>
</aside>

HTML5 <footer> Tag

The <footer> tag specifies the footer of the document or section. A footer usually contains the name of author, copyright information, links to term of use, contact information etc.

For example:
<footer>
<p>Posted by: Hege Refsnes</p>
<p>Contact information: <a href="mailto:someone@example.com">someone@example.com</a>.</p>
</footer>

HTML5 <details> tag

The <details> tag specifies additional details that the user can view or hide on demand. It can be used to create an interactive widget that the user can open and close. Any sort of content can be put inside the <details> tag.

For example:
<details>
<summary>Copyright.</summary>
<p>by Edwin Ronald Lambert.</p>
<p>HTML is fun.</p>
</details>

HTML5 <dialog> Tag

The <dialog> tag is used to define dialog box or a window. The <dialog> element makes it easy to create popup dialog and modal in a web page.

For example:
<dialog open>This is a dialog!</dialog>

HTML5 <summary> Tag

The <summary> tag is used to define a visible heading for the <details> element. The heading can be clicked to view/hide the details.

For example:
<details>
<summary>Copyright 2014 </summary>
<p>Posted by: Edwin Ronald Lambert</p>
<p>All Rights Reserved</p>
<details>

HTML <iframe> Tag

The <iframe> tag is used to display an inline frame. That is to display a web page within a web page. It is used to embed another document inside the current document.

For example:

<iframe src="http://weblearntech.blogspot.in/"></iframe>

Friday, 24 April 2015

What is Bootstrap?

Bootstrap is a powerful free front-end framework for faster and better web development. Bootstrap includes HTML and also CSS based designs for typography, layout, forms, buttons, images etc. It also contains many JavaScript plugins. Bootstrap also has the ability to create responsive websites. Responsive websites are those websites that automatically adjust their design so as to work perfectly in all devices ranging from smart phones to desktop PC.

Bootstrap was developed by Mark Otto and Jacob Thornton at Twitter, and released as an open source product in August 2011 on GitHub.

Advantages of Bootstrap

  • It is easy to use: Anybody who knows basic knowledge in HTML and CSS can design using Bootstrap.
  • Responsive: Used to create responsive pages which adjust automatically as the device needs.
  • Mobile-first framework: Mobile-first are also a part of the core framework.
  • Browser compatible: Bootstrap is compatible with all browsers now a days.

Get Bootstrap

There are two ways by which you can access Bootstrap.

Bootstrap CDN

You can also host Boostrap yourself, you can just include it from a CDN (Content Delivery Network). MaxCDN provides the CDN support fot Boostrap.

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">

Thursday, 23 April 2015

HTML Multimedia

Multimedia comes in different format. It can be pictures, audio, video, animation and much more. Modern web pages often have embedded multimedia elements and supports various multimedia format.

Multimedia Formats

Multimedia elements like audio and video are stored in media files. The most common way to look up a media file is to look its extension.

HTML5 <audio> Tag

Before HTML5, audio was played with a plug-in. HTML5
<audio controls>
<source src="song.ogg" type="audio/ogg"></source>
<source src="song.mp3" type="audio/mpeg"></source>
<source src="song.wav" type="audio/wav"></source>
</audio>

Audio Formats
MIDI .mid
.midi
MIDI (Musical Instrument Digital Interface) is a format for electronic music devices.
RealAudio .rm
.ram
RealAudio was developed to allow streaming of audio with low bandwidth.
WMA .wma WMA files can be delivered as a continuous flow of data, which make it practical for use in Internet Radio.
AAC .aac AAC was developed by Apple as the default format for iTunes.
WAC .wav WAV is compatible with Windows, Macintosh and Linux.
Ogg .ogg Ogg was developed by Xiph.Org Foundation.
MP3 .mp3 MP3 is the most popular sound format. It is supported in all major browsers.

HTML5 <video> Tag

Before HTML5, video was played with a plug-in. HTML5 <video> element is used with which one can embed video files on a web page. HTML5 on supports MP4, WebM and Ogg video file.

For example:
<video height="240" width="320" controls>
<source src="movie.ogg" type="video/ogg"></source>
<source src="movie.mp4" type="video/mp4"></source>
<source src="movie.webm" type="video/webm"></source>
</video>

Video Format
AVI .avi AVI was developed by Microsoft, therefore can be played in Windows Computer.
WMV .wmv WMV was developed by Microsoft, therefore can be played in Windows Computer.
Quicktime .mov Quicktime was developed by Apple, therefore can be played in Apple Computer.
RealVideo .rm
.ram
RealVideo was developed to allow streaming of audio with low bandwidth.
Flash .swf
.flv
Flash was developed by macromedia.
Ogg .ogg Ogg was developed by Xiph.Org Foundation.
WebM .webm WebM is a project by the web giants Mozilla, Opera, Adobe and Google.
MPEG .mpg
.mpeg
MPEG is the most popular video format in the internet.
MPEG-4 or MP4 .mp4 MP4 is the upcoming video format of the internet.

HTML5 <source> Tag

The <source> tag is used to specify multiple media resources for media elements such as <audio> and <video>. The <source> tag allows you to specify alternate video or audio files which the browser may choose from, based on its media types and codec support.

For example:
<audio controls>
<source src="song.ogg" type="audio/ogg">
<source src="song.mp3" type="audio/mpeg">
<source src="song.wav" type="audio/wav">
</audio>

HTML5 <track> Tag

The <track> tag is used to specify text tracks for media elements. This element is used to specify subtitles, caption files or other files containing text, that should be visible while the media is playing.

For example:
<video width="320" height="240" controls>
<source src="movie.ogg" type="video/ogg">
<source src="movie.mp4" type="video/mp4">
<source src="movie.webm" type="video/webm">
<track src="subtitles_en.vtt" kind="subtitle" srclang="en" label="English">
</video>

HTML Plug-ins

Plug-ins are used to extend the functionality of the HTML browser. A plug-in is a small computer program that can be used for many purpose: to display maps, scan for viruses and much more. Some of the well-known plug-ins are java applets and Adobe flash player. Plug-ins are added using the <object> tag and <embed> tag.

HTML <object> Tag
The <object> tag is used to define an embedded object within an HTML document. It is supported by all major browsers. It is used to embed plug-ins in Web pages.

For example:
Audio:
<object height="50" width="100" data="song.mp3"></object>
Video:
<object data="movie.mp4" height="200" width="200"></object>
HTML <embed> Tag
The <embed> tag is used to define a container for an external application or interactive content. It is supporteddi in all major browsers

For example:
Audio:
<embed height="50" width="100" data="song.mp3">
Video:
<embed src="movie.mp4" height="200" width="200">
HTML <param> Tag
The <param> tag is used to define parameters for plug-ins embedded with <object> tag.

For example:
<object data="song.mp3">
<param name="autoplay" value="true">
</object>

Introduction to jQuery

jQuery is a lightweight "write less, do more" JavaScript library. The purpose of jQuery is to make JavaScript easy to use on our website. jQuery take a lot of common task that requires a lot of JavaScript code and wraps them into less code or just a single line. jQuery also simplifies a lot of complicated things from JavaScript like AJAX calls, and DOM manipulation. The jQuery library contains the following features.
  • HTML/DOM manipulation
  • CSS manipulation
  • HTML event methods
  • Effects and Animations
  • AJAX
  • Utilities
There are a lot of other JavaScript frameworks out there, but jQuery seems to be the most popular, and also the most expendable. This is because the jQuery team have written the knowledge of cross-browser issues into the jQuery library. Therefore, it will exactly the same in all browsers, including Internet Explorer 6. Many of the biggest companies use jQuery:
  • Google
  • Microsoft
  • IBM

Addding jQuery to your webpage

There are several ways to add jQuery on your website.
  • Download the jQuery library from jQuery.com
  • Include jQuery from a CDN

Downloading jQuery

There are two versions of jQuery available for downloading:
  • Production Version
  • Development Version
The jQuery library is a single JavaScript file and should be linked with the HTML <script> tag
<head>
<script src="jquery-1.11.0.min.js"></script>
</head>

Alternatives to Downloading

If you don't want to download and host jQuery directly, you can include it from a CDN (Content Delivery Network). Both Google and Microsoft host jQuery

Google CDN:
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/<br />jquery.min.js"></script>
</head>
Microsoft CDN:
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.min.js"></script>
</head>

CSS Text Formatting

HTML text can be styled using CSS. Text formatting properties are used for this purpose.

Text Color

The color property is used to color the HTML text. In CSS, color options can be given by three different ways:
  • HEX value - #000000
  • RGB value - rgb(0,0,0)
  • Color name - Black
For example:
<!DOCTYPE html>
<html>

<head>
<style>
h1.color {color:red;}
p.color {color:blue;}
</style>
</head>

<body>
<h1 class="color">This is a Heading</h1>
<p class="color">This is a paragraph</p>
</body>
</html>

Direction

The direction property is used to denote the text direction or the direction in which the text is written.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.dir {direction:rtl;}
</style>
</head>

<body>
<p>This paragraph is in default direction.</p>
<p class="dir">This paragraph is from right to left.</p>
</body>
</html>

Letter Spacing

The letter-spacing property is used to increase or decrease the space between the characters in a text.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
h1.letter_space {letter-spacing:3px;}
h2.letter_space {letter-spacing:-3px}
</style>
</head>

<body>
<h1 class="letter_space">This is a Heading</h1>
<h2 class="letter_space">This is a Heading</h2>
</body>
</html>

Line Height

The line-height property is used to specify the height of each line.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.small {line-height:50%;}
p.big {line-height:200%;}
</style>
</head>

<body>
<p class="small">This is a paragraph
This is a paragraph
This is a paragraph</p>
<p class="big">This is a paragraph
This is a paragraph
This is a paragraph</p>
</body>
</html>

Text Align

The text-align property is used to horizontally align the text.

For example:

<!DOCTYPE html>
<html>

<head>
<style>
h1.align {text-align:left;}
h2.align {text-align:center;}
h3.align {text-align:right;}
</style>
</head>

<body>
<h1 class="align">This is a Heading</h1>
<h2 class="align">This is a Heading</h2>
<h3 class="align">This is a Heading&lt/h3>
</body>
</html>

Text Decoration

The text-decoration property is used to specify the decoration added to the element.

For example:

<!DOCTYPE html>
<html>

<head>
<style>
h1.decoration {text-decoration:overline;}
h2.decoration {text-decoration:line-through;}
h3.decoration {text-decoration:underline;}
</style>
</head>

<body>
<h11 class="decoration">This is a Heading</h1>
<h21 class="decoration">This is a Heading</h2>
<h31 class="decoration">This is a Heading</h3>
</body>
</html>

Text Indent

The text-indent property is used to specify the indentation of the first line of the text.

For example:

<!DOCTYPE html>
<html>

<head>
<style>
p.indent {text-indent:50px;}
</style>
</head>

<body>
<p class="indent">CSS is used to control the style and layout of multiple 
web pages. It defines how to style HTML elements. An HTML element can be 
 displayed with different styles using CSS.</p>
</body>
</html>

Text Shadow

The text-shadow property is used to add shadow to text element.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
h1.shadow {text-shadow:5px 5px #ffffff;}
</style>
</head>

<body>
<h1 class="shadow">This Heading have Shadow</h1>
</body>
</html>

Text Transform

The text-property is used to specify the capitalization of the text element.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.uppercase {text-transform:uppercase;}
p.lowercase {text-transform:lowercase;}
p.capitalize {text-transform:capitalize;}
</style>
</head>

<body>
<p class="uppercase">This is a Paragraph</p>
<p class="lowercase">This is a Paragraph</p>
<p class="capitalize">This is a Paragraph</p>
</body>
</html>

Unicode Bi-Directional Text

The unicode-bidi property is used along with the direction property to set whether the text should be overridden to support multiple languages.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.dir_bidi {direction:rtl;
unicode-bidi:bidi-override;}
</style>
</head>

<body>
<p>This paragraph is in default direction.</p>
<p class="dir_bidi">This paragraph is from right to left.</p>
</body>
</html>

Vertical Align

The vertical-align property is used to set the vertical align of a text element.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
img.top {vertical-align:top;}
img.bottom {vertical-align:botoom;}
</style>
</head>

<body>
<p>This <img class="top" src="Birds.jpg" />paragraph is  at the top of the 
 image.</p>
<p>This <img class="bottom" src="Birds.jpg" />paragraph is  at the bottom
  of the image.</p>
</body>
</html>

White Space

The white-space property is used to specify how to handle white spaces inside an HTML document.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.white_space {white-space:nowrap}
</style>
</head>

<body>
<p class="white_space">This is a paragraph. This is another paragraph. This 
 is yet another paragraph and so the number of paragraphs continues.</p>
</body>
</html>

Word Spacing

The word-spacing property is used to increase or decrease the white space between words.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.word_space {word-spacing:20px}
</style>
</head>

<body>
<p class="word_space">This is a paragraph.</p>
</body>
</html>

Wednesday, 22 April 2015

HTML Images

HTML has the function to add images also. Adding images, increases the design and creativity of the page. Today, almost all web pages have images.

HTML <img> Tag

In HTML, images are added using the <img> tag. It is an empty tag, so there is no need of closing it. To display the images, you will have to use the "src" attribute to find the destination source of the image.

For example:
<img src="web.jpg">

We use the "alt" attribute to specify an alternate text, when the image is not displayed or the source of the image is broken. We can give any text to the alt attribute value, because they are author-defined text.

For example:
<img alt="Web" src="web.jpg">

The "height" and "width" attribute are used to specify the height and width of the image. It is specified in pixels.
For example:
<img alt="Web" height="100px" src="web.jpg" width="100px">

HTML <map> Tag

The <map> tag is used to define a client-side image map. An image map is a image which have clickable areas. The "name" attribute of the image map is associated with the images usemap attribute to create a relation between them. The <map> tag contains area element, that defines clickable areas.

For example:
<img alt="Web" br="" height="100px" src="web.jpg" width="100px" usemap=#web>
<map name="#web">
<area alt="HTML" coords="80, 92, 95" href="html.html" shape="poly"></area>
<area alt="CSS" coords="180, 92, 105" href="css.html" shape="circle"></area>
<area alt="Bootstrap" coords="180, 120, 95" href="bootstrap.html" shape="poly"></area>
</map>

HTML <area> Tag

The <area> tag is used to define a clickable area inside a image map. It is always nested inside the map element.

For example:
<img alt="Web" br="" height="100px" src="web.jpg" width="100px" usemap=#web>
<map name="#web">
<area alt="HTML" coords="80, 92, 95" href="html.html" shape="poly"></area>
<area alt="CSS" coords="180, 92, 105" href="css.html" shape="circle"></area>
<area alt="Bootstrap" coords="180, 120, 95" href="bootstrap.html" shape="poly"></area>
</map>

HTML <canvas> Tag

The <canvas> tag is used to draw graphics using scripts mainly JavaScript. The <canvas> tag is just a container for the graphics, we have to use javaScript to draw the graphics.

For example:
<canvas id="myCanvas"></canvas>
<script>
var canvas=document.getElementById('myCanvas');
var ctx=canvas.getContext('2d');
ctx.fillStyle='#FFFF00';
ctx.fillRect(0,0,100,100);
</script>

HTML <figure> Tag

the <figure> tag is used to specify a self-contained content like illustration, diagrams, photos, code listing etc.

For example:
<figure>
<img alt="Web" height="100px" src="web.jpg" width="100px">
</figure>

HTML <figcaption> Tag

The <figcaption> tag used to define a caption to the figure. The <figcaption> element can be placed as the first or last child of the <figure> element.

For example:
<figure>
<img alt="Web" height="100px" src="web.jpg" width="100px">
<figcaption>Fig1 : The picture of web languages</figcaption>
</figure>

Sunday, 19 April 2015

HTML Links

A link is group of words or images used to jump from one page to another. They are the most fundamental tag in the HTML page. So they are found mainly in all websites.

HTML <a> Tag

A <a> tag is used to jump from one page to another. It is used to display hyperlinks. When you rollover the cursor above the link, it turn into a little hand. The "href" attribute is used to denote the source of the link. It denotes the destination of the link.

For example:
<a href="https://www.blogger.com/index.html">HOME</a>
The target attribute is used to specify where to open the document. The target attribute can be given the following values:
  • _blank
  • _parent
  • _self
  • _top
For example:
<a href="https://www.blogger.com/index.html" target="_blank">HOME</a>
The id attribute is used to create bookmark inside the document itself.
<a href="#html5">See HTML5 Section</a>
<a id="html5">Introduction to HTML5</a>

For example:
<a href="#C10">See Chapter 10</a>
<h1>Chapter 1</h1>
<h1>Chapter 2</h1>
<h1>Chapter 3</h1>
<h1>Chapter 4</h1>
<h1>Chapter 5</h1>
<h1>Chapter 6</h1>
<h1>Chapter 7</h1>
<h1>Chapter 8</h1>
<h1>Chapter 9</h1>
<h1><a id="C10">Chapter 10</a></h1>
<h1>Chapter 11</h1>
<h1>Chapter 12</h1>
<h1>Chapter 13</h1>
<h1>Chapter 14</h1>
<h1>Chapter 15</h1>
<h1>Chapter 16</h1>
<h1>Chapter 17</h1>
<h1>Chapter 18</h1>
<h1>Chapter 19</h1>
<h1>Chapter 20</h1>
Hyperlinks can also be used to link email address. For that, we use the mailto:email_address in the href attribute.

For example:
<a href="mailto:edwinronaldlambert30@gmail.com">Send Mail</a>

HTML <nav> Tag

The <nav> tag is used to denote a set of navigation links. All the links inside the nav element will be regarded as a navigation link.

For example:
<nav>
<a href="https://www.blogger.com/html">HTML</a> |
<a href="https://www.blogger.com/css">CSS</a> |
<a href="https://www.blogger.com/javascript">JavaScript</a> |
<a href="https://www.blogger.com/jquery">jQuery</a>
</nav>

Introduction to Bootstrap 3

Bootstrap 3
Bootstrap is a powerful and popular HTML, CSS, and JavaScript framework for creating responsive, mobile-first websites for faster and easier web develpoing. It can be designed by everyone who knows a little knowledge of HTML, CSS or JavaScript or all. It is user-friendly and is made for folks of all skill levels, devices of all shapes, and projects of all sizes.

Bootstrap is completely free to download. Download it here - getbootstrap.com.

For example:
<div class="container">
  <div class="jumbotron">
    <h1>My First Page</h1>
    <p>Resize this page and see the magic!</p>
  </div>
  <div class="row">
    <div class="col-sm-4">
      <h3>Column 1</h3>
      <p>This is just a sample text...</p>
      <p>This is just a sample text...This is just a sample text...</p>
    </div>
    <div class="col-sm-4">
      <h3>Column 2</h3>
      <p>This is just a sample text...</p>
      <p>This is just a sample text...This is just a sample text...</p>
    </div>
    <div class="col-sm-4">
      <h3>Column 3</h3>
      <p>This is just a sample text...</p>
      <p>This is just a sample text...This is just a sample text...</p>
    </div>
  </div>
</div>

JavaScript in HTML

JavaScript is mainly used to manipulate the HTML elements. JavaScript gives us the full freedom to add interactivity and responsiveness to our web page. As all of you know, HTML is used to give a structure to our web page and CSS is used to change the appearance of our page. But do you know why JavaScript is used? If you don't there is no problem. JavaScript is a web programming language that enables us to control how a webpage behaves. This make this language very crucial in web designing. Using JavaScript, we can do many things such as:
  • Put text in HTML page anytime.
  • Make your web page responsive and efficient.
  • Used to detect visitor's browser.
  • Create cookies
  • Validate Form
  • and much more.

Writing JavaScript code

Writing a JavaScript code is easy but one simple mistake can lead you to scratching your head. So whenever you type a code be sure that the code you are writing is completely perfect. JavaScript code is written between the <script> tag. A JavaScript code starts with document.write and the code is written between a pair of parenthesis. Note that, when you execute a text using document.write on a HTML page, the HTML element will be overwritten.

For example:
<!DOCTYPE html>
<html>

<body>
<h1>My Webpage</h1>

<script>
document.write("<p>My first JavaScript text</p>");
</script>

</body>
</html>

We can also write a document.write code by calling out a function.

For example:
<!DOCTYPE html>
<html>

<body>
<h1>My Webpage</h1>

<script>
function myFunction()
{
document.write("<p>My first JavaScript text</p>");
}
</script>

<button onclick="myFunction()">Try it<button> 

</body>
</html>

Accessing a HTML element

To access a HTML element, we use the document.getelementById() method. We use the id attribute to denote which HTML element to be accessed upon.

For example:
<!DOCTYPE html>
<html>

<body>
<h1>My Webpage</h1>
<p id="demo">A paragraph</h1>

<script>
function myFunction()
{
document.getElementById("demo").innerHTML="My JavaScript text";
}
</script>

<button type="button" onclick="myFunction()">Try it<button> 

</body>
</html>

Wednesday, 15 April 2015

CSS Font

The CSS Font property defines the font family, boldness, size and style of the text

Font

The font property is used to set all the font properties in one declaration. The font properties are set in the order of "font-style, font-variant, font-weight, font-size, font-family."

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.html_font {font:"italic bold 15px "Georgia, Serif;}
</style>
</head>

<body>
<p class="html_font">Hyper Text Markup Language</p>
</body>

</html>

Font Family

The font family of a text is set with the font-family property. The font-family property should contain several font names, so that the next font will be displayed if the first font is not present. If the names of the font is more than one word, then it should be contained in a pair of double quotes like "Times New Roman". If there are more than one font, then it should be separated by commas.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.html_fontfamily {font-family:"Times New Roman", Times, Serif;}
p.css_fontfamily {font-family:Arial, Helvetica, sans-serif;}
</style>
</head>

<body>
<p class="html_fontfamily">Hyper Text Markup Language</p>
<p class="css_fontfamily">Cascading Style Sheets</p>
</body>

</html>

Font Size

The font-size property sets the size of the text. Managing the text size is important, but it should not be used to make the text look like heading or so. The font-size value can be absolute or relative size. Font size can be denoted in percentage, pixels, and in emphemeral unit (em).

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.html_size {font-size:90%;}
p.css_size {font-size:10px;}
p.javascript_size (font-size:1.5em;)
</style>
</head>

<body>
<p class="html_size">Hyper Text Markup Language</p>
<p class="css_size">Cascading Style Sheets</p>
<p class="javascript_size">JavaScript</p>
</body>

</html>

Font Style

The font-style property is commonly used to style text. This property has the following values:
  • normal
  • italic
  • oblique
For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.html_style {font-style:normal;}
p.css_style {font-style:italic;}
p.javascript_style {font-style:oblique;}
</style>
</head>

<body>
<p class="html_style">Hyper Text Markup Language</p>
<p class="css_style">Cascading Style Sheets</p>
<p class="javascript_style">JavaScript</p>
</body>

</html>

Font Variant

The font-variant property is used to display the text into a small-caps form. In the small-caps font, all lowercase characters are transformed into upper characters, but will be somewhat smaller in size.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.html_variant {font-variant:normal;}
p.css_variant {font-variant:small-caps;}
</style>
</head>

<body>
<p class="html_variant">Hyper Text Markup Language</p>
<p class="css_variant">Cascading Style Sheets</p>
</body>

</html>

Font Weight

The font-weight property is used to make the text thick or thin.

For example:
<!DOCTYPE html>
<html>

<head>
<style>
p.html_weight {font-weight:normal;}
p.css_weight {font-weight:lighter;}
p.javacript_weight {font-weight:bolder;}
p.jquery_weight {font-weight:100;}
</style>
</head>

<body>
<p class="html_weight">Hyper Text Markup Language</p>
<p class="css_weight">Cascading Style Sheets</p>
<p class="javascript_weight">JavaScript</p>
<p class="jquery_weight">jQuery</p>
</body>

</html>

Sunday, 5 April 2015

CSS Background

CSS background property is used to define the background properties of an element. The background properties used in CSS are:
  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background position

Background

There are many properties when dealing with CSS backgrounds. So to shorten the code, it is best to specify all the properties in a single property. This is called the shorthand property of background. There is no problem if one of the content is missing as long as the ones that are present are in correct order.

For example:
body { 
background:#ffffff url('logo.png') no-repeat fixed top; 
}

Background Color

The background-color property is used to specify the background color of an element. The background color of a page should be declared in the body itself.
In CSS, color options can be given by three different ways:
  • HEX value - #000000
  • RGB value - rgb(0,0,0)
  • Color name - Black
For example:
body { background-color:#e0ffff; }

Background Image

The background-image property is used to specify a background picture in an HTML page. By default, the background image will be repeated to cover all area.

For example:
body { background-image:url("image.png") }

Background Repeat

By default, the background image will be repeated both horizontally and vertically so that it will cover all the region. But using the background-repeat property, we can adjust the repeating option of the image file.
We can adjust the image in the following four ways
  • repeat - Default option, the image will be repeated both horizontally and vertically
  • repeat-x - The image will be repeated horizontally only.
  • repeat-y - The image will be repeated vertically only
  • no-repeat - The image will not be repeated.
For example:
body { background-image:url("image.png"); 
       background-repeat:repeat-x; 
     }

Background Position

The background-position property is used to adjust the position of the image file to a specific position so that it does not disturb the elements.

For example:
body { background-image:url("image.png"); 
       background-repeat:repeat-x; 
       background-position:center; 
     }

Background Attachment

The background-attachment property is used to set whether the image is fixed or it scrolls with the element.
We can attach the elements in the following ways
  • scroll - The background scrolls along with the element.
  • fixed - The background is fixed.
  • local - The background scrolls along with the element's contents.
For example:
body { background-image:url("image.png"); 
       background-repeat:repeat-x; 
       background-position:center; 
       background-attachment:fixed;
     }

HTML Lists

Lists are used to order things or objects of the same category. They are used to number these objects according to a number. The most common types of lists are ordered list and unordered list.

Ordered List

The <ol> tag is used to denote an ordered lists. The ordered lists can be numerical or alphabetical in order.

Ordered lists can be denoted in the following types:

  • 1 - Represented in numerical order
  • A - Represented in uppercase alphabetical order
  • a - Represented in lowercase alphabetical order
  • I - Represented in uppercase roman numerals
  • i - Represented in lowercase roman numerals
For example:
<ol>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>

Unordered List

The <ul> tag is used to denote an unordered lists. The unordered lists are bulleted in order.

Unordered lists can be denoted in the following types:

  • disc - Represented in disc shape
  • square - Represented in square shape
  • circle - Represented in circle shape
For example:
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>

List Item

The <li> tag is used to denote a list item. List items are used in ordered list, unordered list and menu list.

For example:
<ol>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>

<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>

Definition List

A definition list is a list of terms with a description of each term. The <dl> tag is used to denote a definition list. The <dl> tag is used in conjunction with the <dt> tag (Definition Term) and the <dd> tag (Definition Data). The <dt> tag is used to define a term name in the definition list and the <dd> tag is used to describe the term name in the definition list.

For example:
<dl>
<dt>HTML</dt>
<dd>Used to describe web pages.</dd>
<dt>CSS</dt>
<dd>Used to style web pages.</dd>
</dl>

Menu List

The <menu> tag denotes a menu list. The menu list is used to define a list of commands. It is also used for context menus, toolbar and for listing forming controls and commands. In fact, menu element is not supported in any browser at the present.

For example:
<menu type="web">
<li>
<button type="button" onclick="file_new()">New</button>
<button type="button" onclick="file_open()">Open</button>
<button type="button" onclick="file_save()">Save</button>
</li>
</menu>

The <menuitem> Tag

The <menuitem> tag defines a menu that the user can invoke from a pop-up menu. Currently, this function is supported in Firefox only.

For example:
<menu type="context" id="mymenu">
<menuitem label="Refresh" onclick="windows.location.reload()" 
 icon="ico_reload.png">
</menuitem>
</menu>