css comprehensive overview

38
CSS Mohamed Loey

Upload: benha-university

Post on 16-Apr-2017

702 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: CSS Comprehensive Overview

CSSMohamed Loey

Page 2: CSS Comprehensive Overview

Agenda

Part I: IntroductionPart II: CSSPart III: CSS Properties

Page 3: CSS Comprehensive Overview

Agenda

Part I: IntroductionWhat is CSS? History of CSSAdvantages of CSS

Page 4: CSS Comprehensive Overview

What is CSS?• CSS stands for Cascading Style Sheets• Styles define how to display HTML

elements• External Style Sheets can save a lot of

work

Page 5: CSS Comprehensive Overview

History of CSS• CSS was proposed in 1994 as a web styling

language. To helps solve some of the problems HTML.

• There were other styling languages proposed at this time, such as Style Sheets for HTML but CSS won.

• CSS2 became the recommendation in 1998 by W3C

• CSS3 was started in 1998 but it has never been completed. Some parts are still being developed and some components work on some browsers.

Page 6: CSS Comprehensive Overview

Advantages of CSS• Saves time• Easy to change• Give you more

control over layout• Make it easy to

create a common format for all the Web pages

Page 7: CSS Comprehensive Overview

Agenda

Part II: CSSCSS Syntax Inserting CSSCSS Selectors

Page 8: CSS Comprehensive Overview

CSS Syntax

Page 9: CSS Comprehensive Overview

inserting CSS• Three Ways to Insert CSS:

1. Inline style2. Internal style sheet3. External style sheet

Page 10: CSS Comprehensive Overview

Inline style• An inline style loses many of the

advantages of a style sheet

Page 11: CSS Comprehensive Overview

Inline style• On Chrome Browser:

Page 12: CSS Comprehensive Overview

Internal style sheet• An internal style sheet should be used

when a single document has a unique style.

• You define internal styles in the head section of an HTML page, inside the <style> tag.

Page 13: CSS Comprehensive Overview

Internal style sheet• Example :

Page 14: CSS Comprehensive Overview

External style sheet• 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 just one file.

• Each page must include a link to the style sheet with the <link> tag. The <link> tag goes inside the head section

Page 15: CSS Comprehensive Overview

External style sheet• An external style sheet can be written in

any text editor.• The style sheet file must be saved with a

.css extension.• "myStyle.css":

Page 16: CSS Comprehensive Overview

CSS Selectors• CSS selectors allow you to select and

manipulate HTML element(s).• CSS Selectors Consist of:

1. The element Selector2. The id Selector3. The class Selector4. Grouping Selectors

Page 17: CSS Comprehensive Overview

The element Selector• The element selector selects elements

based on the element name.• Example:

Page 18: CSS Comprehensive Overview

The id Selector• The id selector uses the id attribute of

an HTML tag to find the specific element.

• Example:

Page 19: CSS Comprehensive Overview

The class Selector• The class selector finds elements with

the specific class. • Example:

Page 20: CSS Comprehensive Overview

Grouping Selectors• To minimize the code, you can group

selectors.• Example:

Page 21: CSS Comprehensive Overview

Agenda

Part II: CSS PropertiesCSS TextCSS FontCSS BackgroundsCSS Links

Page 22: CSS Comprehensive Overview

CSS Text• Color• Text Align• Text Decoration• Text Transform

Page 23: CSS Comprehensive Overview

Colorcolor: value;

• Possible values are: 1. a HEX value - like "#ff0000"2. an RGB value - like "rgb(255,0,0)"3. a color name - like "red"

Example

Page 24: CSS Comprehensive Overview

Text Colortext-align: value;

• Possible values are:1. left2. right3. center4. justify

Example

Page 25: CSS Comprehensive Overview

Text Decoration text-decoration: value;

• Possible values are:1. none2. underline3. overline4. line through5. blink

Example

Page 26: CSS Comprehensive Overview

Text Transformtext-transform: value;

• Possible values are:1. none2. capitalize3. lowercase4. uppercase

Example

Page 27: CSS Comprehensive Overview

Text Indenttext-indent: value;

• Possible values are:1. length2. percentage

Example

Page 28: CSS Comprehensive Overview

CSS Font• Font• Font-Family• Font Size• Font Style

Page 29: CSS Comprehensive Overview

Fontfont: value;

• Possible values are:1. size2. type

Example

Page 30: CSS Comprehensive Overview

Font-Family font-family: value;

• There are 2 choices for values:1. family-name2. generic family

Example

Page 31: CSS Comprehensive Overview

Font Size   font-size: value;

• There are a lot of choices for values:• xx-large, x-large, larger, large • medium, small• Smaller, x-small ,xx-small• length• % (percent)

Example

Page 32: CSS Comprehensive Overview

Font Style    font-style: value;

• Possible values are1. normal2. italic3. oblique

Example

Page 33: CSS Comprehensive Overview

CSS Backgrounds• Background Color• Background Image

Page 34: CSS Comprehensive Overview

Background Color    background-color: value;

• Possible values:1. color name2. hexadecimal number3. RGB color code4. transparent

Example

Page 35: CSS Comprehensive Overview

Background Image    background-image:

url(path_to_image);• Possible Values:

1. url2. none

Example

Page 36: CSS Comprehensive Overview

CSS Links• Links can be styled with any CSS property (e.g.

color, font-family, background, etc.).• In addition, links can be styled differently

depending on what state they are in.• The four links states are:

1. a:link - a normal, unvisited link2. a:visited - a link the user has visited3. a:hover - a link when the user mouses over it4. a:active - a link the moment it is clicked

Page 37: CSS Comprehensive Overview

CSS Links• Example:

Page 38: CSS Comprehensive Overview

THANK U