Wednesday, August 31, 2016

Welcome to world of CSS (color sheet styling).

 

 HTML BASIC
Introduction to CSS
Using External CSS:
<link>
The <link> element can be used in an HTML document to tell the browser where to find the CSS file used to style the page. It is an empty element (meaning it does not need a closing tag), and it lives inside the <head> element. It should use three attributes:
href
This specifies the path to the CSS file (which is often placed in a folder called css or styles).
type
This attribute specifies the type of document being linked to. The value should be text/css.
rel
This specifies the relationship between the HTML page and the file it is linked to. The value should be stylesheet when linking to a CSS file. An HTML page can use more than one CSS style sheet. To do this it could have a <link> element for every CSS file it uses. For example, some authors use one CSS file to control the presentation (such as fonts and colors) and a second to control the layout
Example:
<!DOCTYPE html>
<html>
<head>
<title>Using External CSS</title>
<link href="css/styles.css" type="text/css"
rel="stylesheet" />
</head>
<body>
<h1>Potatoes</h1>
<p>There are dozens of different potato
varieties. They are usually described as

early, second early and maincrop.</p>
</body>
</html>
Using Internal CSS:
<style>
You can also include CSS rules within an HTML page by placing them inside a <style> element, which usually sits inside the <head> element of the page. The <style> element should use the type attribute to indicate that the styles are specified in CSS. The value should be text/css.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Using Internal CSS</title>
<style type="text/css">
body {
font-family: arial;
background-color: rgb(185,179,175);}
h1 {
color: rgb(255,255,255);}
</style>
</head>
<body>
<h1>Potatoes</h1>
<p>There are dozens of different potato
varieties. They are usually described as
early, second early and main crop.</p>
</body>
</html>
CSS Selectors:
There are many different types of CSS selector that allow you to target rules to specific elements in an HTML document. The table on the opposite page introduces the most commonly used CSS selectors. On this page, there is an HTML file to demonstrate which
elements these CSS selectors would apply to. CSS selectors are case sensitive, so they must match element names and attribute values exactly.
Example:
<!DOCTYPE html>
<html>
<head>
<title>CSS Selectors</title>

</head>
<body>
<h1 id="top">Kitchen Garden Calendar</h1>
<p id="introduction">Here you can read our
handy guide about what to do when.</p>
<h2>Spring</h2>
<ul>
<li><a href="mulch.html">
Spring mulch vegetable beds</a></li>
<li><a href="potato.html">
Plant out early potatoes</a></li>
<li><a href="tomato.html">
Sow tomato seeds</a></li>
<li><a href="beet.html">
Sow beet seeds</a></li>
<li><a href="zucchini.html">
Sow zucchini seeds</a></li>
<li><a href="rhubarb.html">
Deadhead rhubarb flowers</a></li>
</ul>
<p class="note">
This page was written by
<a href="mailto:ivy@example.org">
ivy@example.org</a> for
<a href="http://www.example.org">Example</a>.
</p>
<p>
<a href="#top">Top of page</a>
</p>
</body>
</html>

How CSS Rules Cascade:
If there are two or more rules that apply to the same element, it is important to understand which will take precedence.
LAST RU LE
If the two selectors are identical, the latter of the two will takeprecedence. Here you can see
the second i selector takes precedence over the first.
SPECIFICITY
If one selector is more specific than the others, the more specific rule will take precedence
over more general ones. In this example:
h1 is more specific than *
p b is more specific than p

p#intro is more specific than p
IMPORTANT
You can add !important after any property value to indicate that it should be considered more important than other rules that apply to the same element. Understanding how CSS rules
cascade means you can write simpler style sheets because you can create generic rules that apply to most elements and then override the properties on individual elements that need to appear differently.
Example:
<h1>Potatoes</h1>
<p id="intro">There are <i>dozens</i> of different <b>potato</b> varieties.</p>
<p>They are usually described as early, second early and maincrop potatoes.</p>
* {
font-family: Arial, Verdana, sans-serif;}
h1 {
font-family: "Courier New", monospace;}
i {
color: green;}
i {
color: red;}
b {
color: pink;}
p b {
color: blue !important;}
p b {
color: violet;}
p#intro {
font-size: 100%;}
p {
font-size: 75%;}
Inheritance
you specify the font-family or color properties on the <body> element, they will apply to most child elements. This is because the value of the font-family property is inherited by child elements. It saves you from having to apply these properties to as many elements (and results in simpler style sheets). You can compare this with the background-color or border properties; they are not inherited by child elements. If these were inherited by all child elements then the page could look quite messy. You can force a lot of properties to inherit values from their
parent elements by using inherit for the value of the properties. In this example, the
<div> element with a class called page inherits the padding size from the CSS rule that
applies to the <body> element

Example:
<div class="page">
<h1>Potatoes</h1>
<p>There are dozens of different potato
varieties.</p>
<p>They are usually described as early, second
early and maincrop potatoes.</p>
</div>
HTML
body {
font-family: Arial, Verdana, sans-serif;
color: #665544;
padding: 10px;}
.page {
border: 1px solid #665544;
background-color: #efefef;
padding: inherit;}
BrowserCam.com
BrowserLab.Adobe.com
BrowserShots.org
CrossBrowserTesting.com
CSS rules usually appear in a separate document, although they may appear within an HTML page.
Declarations are made up of two parts: the properties of the element that you want to change, and the values of those properties. For example, the font-family property sets the choice of font, and the value arial specifies Arial as the preferred typeface.
Color
Ø How to specify Color
Ø Color Terminology and Contrast
Ø Background Color

Foreground Color
The color property allows you to specify the color of text inside an element. You can specify any color in CSS in one of three ways:

rgb values
These express colors in terms of how much red, green and blue are used to make it up. For example: rgb(100,100,90)
hex codes
These are six-digit codes that represent the amount of red, green and blue in a color, preceded by a pound or hash # sign. For example: #ee3e80
color names
There are 147 predefined color names that are recognized by browsers. For example:
DarkCyan We look at these three different ways of specifying colors on the next double-page spread.
Example:
/* color name */
h1 {
color: DarkCyan;}
/* hex code */
h2 {
color: #ee3e80;}
/* rgb value */
p {
color: rgb(100,100,90);}
Background Color
CSS treats each HTML elementas if it appears in a box, and thebackground-color property
sets the color of the background for that box. You can specify your choice of background color in the same three ways you can specify foreground colors: RGB values, hex codes, and color names (covered on the next page). If you do not specify a background color, then the background is transparent. By default, most browser windows have a white background, but browser users can set a background color for their windows, so if you want to be sure that the background is white you can use the background-color property on
the <body> element.
Example:
body {
background-color: rgb(200,200,200);}
h1 {
background-color: DarkCyan;}
h2 {
background-color: #ee3e80;}
p {
background-color: white;}

Tuesday, August 30, 2016

html basic

HTML BASICS 
 (WEB DEVELOPMENT)



Lab Objective: understand the utility of forms on Web pages, various components used in a form and build a simple interactive form.

Interactive Forms

Without forms a website are “read-only”, it just provides information to the user. Forms enable the user to provide information to the web site. For example the user can:
  • Perform searches on web site
  • Give comments
  • Ask for info that is not available on the website
  • Place order for goods and services

Interactive forms can be simple or very complex. They can fill a whole page or just a single line. They can contain a single element or many and are placed between the <body> and </body> tags of a web page. Interactive forms are GUI based and may contain:

  • Text fields
  • Check boxes
  • Buttons
  • Scrollable lists
The HTML form tag <form> and </form> is to create a form in your web page. All the input elements should go between the <form> and </form> tags.
Tags used in the form

·         <form>
 Name= “name of form”
Method= “get” or “post”
Action= “URL” (The HTML form action attribute points to the URL to which the form submission is sent. This will normally be a server side script written in a scripting language)
</form>

·         Single line text input field
<input
Type= “text”
Name= “name”
Size= “width in characters”
maxlength= “limit in characters”
value= “initial default value”
> 

·         Password input field
<input
Type= “hidden”
Name= “name”
Value= “value”
> 

·         Checkbox input element
<input
Type= “checkbox”
Name= “name”
Checked
Value= “value”
> 

·         Radio button input element
<input
Type= “radio”
Name= “name”
Checked
Value= “selected value”
>text1

·         File upload input element
<input
Name= “name”
Value= “name of selected file”
Encrypt= “file encoding type”
> 

·         Reset button input element
<input
Type= “reset”
Value= “button label”
> 

·         Submit button input
<input
Type= “submit”
Name= “name”
Value= “value”
> 
Eight possible values for the “type” attribute of <input> tag:
1.      text
2.      password
3.      hidden
4.      checkbox
5.      radio
6.      file
7.      reset
8.      submit

Multi-line text input area
<TEXTAREA
Name= “area name”
Cols= “width”
Rows= “lines”
>initial default value
</TEXTAREA>

Select from a (Drop down) List
<SELECT
Name= “name”
Size= “number of displayed choices”
> 
<OPTION value= “value1”>text1
<OPTION value= “value2” selected>text2
<OPTION value= “value3”>text3
</SELECT>

Lab Tasks

Write HTML codes for snapshots given below:
Image result for html tables and buttons check boxes

How to show tables and lists

HTML BASICS
HTML LISTS AND TABLES

Lab Objective: extending web pages by adding few more tags, various types of lists and tables

HTML (Hyper Text Markup Language):

HTML is a language, which makes it possible to present information (e.g. scientific research) on the Internet. What you see when you view a page on the Internet is your browser's interpretation of HTML. You use it to create web pages.
HTML is not a programming language, it is a markup language. A markup language is a set of markup tags. HTML uses markup tags to describe web pages. HTML markup tags are usually called HTML tags. HTML tags are keywords surrounded by angle brackets like <html>. HTML tags normally come in pairs like <b> and </b>. The first tag in a pair is the start tag; the second tag is the end tag. Start and end tags are also called opening tags and closing tags.
HTML documents describe web pages. HTML documents contain HTML tags and plain text. HTML documents are also called web pages. The purpose of a web browser (like Internet Explorer or Fire-fox) is to read HTML documents and display them as web pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page.
More about HTML tags:
Single tag
<tag name>
e.g <BR>

Creating Lists:
                                                
To create unordered list you have two tags in HTML, which are <UL> for “unordered list” and <LI> for Line item


  • Code for creating UL is as given below:
                                                   <html>
                                                <ul>My favourite friend</ul>
                                                </html> 

  • In addition to unordered lists, HTML also provides two other types. They are “Ordered List” and “Definition List”.

  • If want to start numbering other than “1” then write <OL start=”25”>
  • If you want to number instead of bullets than write <ul="any number"></ul>
Table Creation:

Table provides more customizable way of displaying ordered data on web pages.
Tables are created by table border first <table border="5"> 5 width of table border is traditional.
 <tr> means table rows and <td> means table data.
Adding list and table to your own website:

Following code will be added for list and table if we want to add content for grading criteria:

·         <h2><b> Grading Criteria List:</h2>
·          
·         <OL >
·         <LI > Quizzes=10</LI>
·         <LI> Assignments=10</LI>
·         <LI> Lab Work=20</LI>
·         <LI> Midterm=20  </LI>
·         <LI> Final Exam=40  </LI>
·         </OL>
·          
·         <h3><b> Grading Criteria Table:</h3>
·          
·         <TABLE border="5">
·         <TR>
·         <TH> Grading Criteria</TH>
·         <TH> Marks</TH>
·         </TR>
·         <TR>
·         <TD>  Quizzes </TD>
·         <TD>10 </TD>
·         </TR>
·         <TR>
·         <TD> Assignments</TD>
·         <TD>10</TD>
·         </TR>
·         <TR>
·         <TD>Lab Work</TD>
·         <TD> 20</TD>
·         </TR>
·         <TR>
·         <TD>Midterm</TD>
·         <TD>20</TD>
·         </TR>
·         <TR>
·         <TD> Final Exam</TD>
·         <TD> 40</TD>
·         </TR>

·         </TABLE>
Put this and if any problem send me snapshot of your code and web page and I will try to make through it.