40
HTML and CSS Basics For Beginners By- Rajesh Vishnani IT Consultant

Design Dream

Embed Size (px)

DESCRIPTION

These are the slides for Design Dream workshop at UVPCE on 19 august 2010

Citation preview

Page 1: Design Dream

HTML and CSSBasics For BeginnersBy- Rajesh Vishnani

IT Consultant

Page 2: Design Dream

Something Interesting

The first person ever to dream of programming a Computer was a WOMAN called

ADA LOVELACE

Ada Lovelace- First Programmer Ever

Page 3: Design Dream

Our List of To- Do

Basic tags in HTML and Basic Web Structure

Creating advance Web Template Structure

Writing simple powerful CSS Design a simple Web Page with

good Looks

Page 4: Design Dream

BASICS OF HTML

Page 5: Design Dream

What is HTML?

HTML is a language for describing web pages.

HTML stands for Hyper Text Markup Language

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

Page 6: Design Dream

HTML Tags HTML markup tags are usually called

HTML tags HTML tags are keywords surrounded

by angle brackets “<>“ like <html> HTML tags normally are 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 called opening

tags and closing tags

Page 7: Design Dream

HTML Headings <h1> defines the largest heading.

<h6> defines the smallest heading.

Page 8: Design Dream

HTML Paragraphs

Paragraphs are defined with the <p> tag.

Page 9: Design Dream

HTML Text Formatting

Page 10: Design Dream
Page 11: Design Dream

HTML Text Formatting TagsTag Description

<b> Defines bold text

<big> Defines big text

<em> Defines emphasized text 

<i> Defines italic text

<small> Defines small text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<ins> Defines inserted text

<del> Defines deleted text

Page 12: Design Dream

HTML Hyperlinks (Links)

Links are specified in HTML using the <a> tag.

The <a> tag can be used in two ways:–To create a link to another document,

by using the href attribute–To create a bookmark inside a

document, by using the name attribute

Page 13: Design Dream

HTML Images

Page 14: Design Dream
Page 15: Design Dream

HTML Styles

Page 16: Design Dream
Page 17: Design Dream

HTML Lists The most common HTML lists are

ordered and unordered lists:

Page 18: Design Dream

<html><body><h4>An Unordered List:</h4><ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li></ul>

Page 19: Design Dream

<h4>An Ordered List:</h4><ol> <li>Coffee</li> <li>Tea</li> <li>Milk</li></ol></body></html>

Page 20: Design Dream

HTML Tables

Tables are defined with the <table> tag.

A table is divided into rows (with the <tr> tag),

each row is divided into data cells (with the <td> tag). td stands for "table data," and holds the content of a data cell.

A <td> tag can contain text, links, images, lists, forms, other tables, etc.

Page 21: Design Dream

<html><body><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><tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table> </body></html>

Page 22: Design Dream
Page 23: Design Dream

HTML Form TagsTag Description

<form> Defines an HTML form for user input

<input /> Defines an input control

<textarea> Defines a multi-line text input control

<label> Defines a label for an input element

<fieldset> Defines a border around elements in a form

<legend> Defines a caption for a fieldset element

<select> Defines a select list (drop-down list)

<optgroup> Defines a group of related options in a select list

<option> Defines an option in a select list

<button> Defines a push button

Page 24: Design Dream

CSS

In HTML 4.0 all formatting can be removed from the HTML document, and stored in a style sheet.Because HTML 4.0 separates the layout from the document structure, we have what we always needed: Total control of layout, without messing up the document content

Page 25: Design Dream

How to Use Styles

When a browser reads a style sheet, it will format the document according to it.

There are three ways of inserting a style sheet:

1. External style sheet2. Internal style sheet3. Inline styles

Page 26: Design Dream

External Stylesheets

An external style sheet is ideal when the style is applied to many pages.

With an external style sheet, you can change the look of an entire Web site by changing one file.

Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the <head> section:

<head><link rel="stylesheet" type="text/css" href="mystyle.css" /></head>

Page 27: Design Dream

Internal Stylesheets

An internal style sheet can be used if one single document has a unique style.

Internal styles are defined in the <head> section of an HTML page, by using the <style> tag

<head><style type="text/css">body {background-color:yellow}p {color:blue}</style></head>

Page 28: Design Dream

Inline Stylesheets An inline style can be used if a unique

style is to be applied to one single occurrence of an element.

To use inline styles, use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example below shows how to change the text color and the left margin of a paragraph:

<p style="color:blue;margin-left:20px">This is a paragraph.</p>

Page 29: Design Dream

CSS Syntax

A CSS rule has two main parts: a selector, and one or more declarations:

Page 30: Design Dream

CSS Id and Class

The id Selector The id selector is used to specify a

style for a single, unique element. The id selector uses the id

attribute of the HTML element, and is defined with a "#".

Page 31: Design Dream

CSS Id and Class

The style rule below will be applied to the element with id="para1":

Example #para1

{text-align:center;color:red;}

Page 32: Design Dream

The class Selector

The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.

This allows you to set a particular style for any HTML elements with the same class.

Page 33: Design Dream

The class Selector

The class selector uses the HTML class attribute, and is defined with a "."

In the example below, all HTML elements with class="center" will be center-aligned:

.center {text-align:center;} You can also specify that only specific HTML

elements should be affected by a class. In the example below, all p elements with

class="center" will be center-aligned: p.center {text-align:center;}

Page 34: Design Dream

CSS Background

CSS background properties are used to define the background effects of an element.

CSS properties used for background effects:1. background-color2. background-image3. background-repeat4. background-attachment5. background-position

Page 35: Design Dream

Back Ground Examples

body {background-color:#b0c4de;} body {background-image:

url('paper.gif');} body

{background-image:url('gradient2.png');background-repeat:repeat-x;}

Page 36: Design Dream

CSS TextProperty Description

color Sets the color of a text

line-height Sets the distance between lines

letter-spacing Increase or decrease the space between characters

text-align Aligns the text in an element

text-decoration Adds decoration to text

text-indent Indents the first line of text in an element

text-transform Controls the letters in an element

vertical-align Sets the vertical alignment of an element

word-spacing Increase or decrease the space between words

Page 37: Design Dream

CSS Font

Property Description

font Sets all the font properties in one declaration

font-family Specifies the font family for text

font-size Specifies the font size of text

font-style Specifies the font style for text

font-variant Specifies whether or not a text should be displayed in a small-caps font

font-weight Specifies the weight of a font

Page 38: Design Dream

CSS Float This property is used to decide if the element

can also accommodate other element beside it There are two values for float property

1. Left: allows other elements on right of it2. Right: allows other elements on right of it

Usually elements float left .thumbnail

{float:left;width:110px;height:90px;margin:5px;}

Page 39: Design Dream

Finally

Put all these elements together and create your home page. Make it attractive.

You don’t need flash, photoshop etc to do that

All you need is imagination

Page 40: Design Dream

Thanks

Speaker:

Mr. Rajesh S VishnaniIT Consultant