css hadas kahsay. overview what is css basic syntax of css rules how to link css style to html...

30
CSS CSS Hadas Kahsay Hadas Kahsay

Upload: elijah-mcdowell

Post on 17-Jan-2018

265 views

Category:

Documents


0 download

DESCRIPTION

What is CSS  Stands for cascading Style Sheets (CSS)  It was developed by W3C in 1996  New feature being added to html that allows web designers more control over how pages are displayed.  It is a simple styling language which allows attaching style to html elements  Allows designers create style sheets that define how different elements in html appear.  It is used to specify styles such as fonts, background colors, margins, etc.  The purpose of CSS is to separate style information from contents.

TRANSCRIPT

Page 1: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

CSSCSSHadas KahsayHadas Kahsay

Page 2: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Overview Overview What is CSSWhat is CSS Basic syntax of CSS RulesBasic syntax of CSS Rules How to link CSS style to html documentsHow to link CSS style to html documents Browsers and CSSBrowsers and CSS Advantages of CSS Advantages of CSS Disadvantages of CSSDisadvantages of CSS Conclusion Conclusion

Page 3: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

What is CSSWhat is CSS Stands for cascading Style Sheets (CSS)Stands for cascading Style Sheets (CSS) It was developed by W3C in 1996It was developed by W3C in 1996 New feature being added to html that allows New feature being added to html that allows

web designers more control over how pages are web designers more control over how pages are displayed.displayed.

It is a simple styling language which allows It is a simple styling language which allows attaching style to html elementsattaching style to html elements

Allows designers create style sheets that define Allows designers create style sheets that define how different elements in html appear. how different elements in html appear.

It is used to specify styles such as fonts, It is used to specify styles such as fonts, background colors, margins, etc.background colors, margins, etc.

The purpose of CSS is to separate style The purpose of CSS is to separate style information from contents. information from contents.

Page 4: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSSBasic syntax Rules of CSS H1 {color: green}H1 {color: green} CSS rules consists two partsCSS rules consists two parts -Selector-Selector - Declaration- Declaration

Page 5: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSS (cont)Basic syntax Rules of CSS (cont)

Declaration also Declaration also consists two partsconsists two parts

-Property-Property -Values-Values

Page 6: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSS (cont)Basic syntax Rules of CSS (cont)

Setting Rule for Multiple html elementsSetting Rule for Multiple html elements H1 {color: green}H1 {color: green} H2 {color: green}H2 {color: green} H3 {color: green}H3 {color: green} Group elements togetherGroup elements together H1, H2, H3 {color: green}H1, H2, H3 {color: green}

Page 7: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSS (cont)Basic syntax Rules of CSS (cont)

Setting Rules for one element w/multiple Setting Rules for one element w/multiple rulesrules

H1 {color: blue}H1 {color: blue} H1 {text-align: center}H1 {text-align: center} H1 {background: yellow}H1 {background: yellow}

Page 8: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSS (cont)Basic syntax Rules of CSS (cont) Use the element onceUse the element once H1 { color: blue; text-align: center; background: H1 { color: blue; text-align: center; background:

yellow }yellow } OrOr H1 H1 { color: blue;{ color: blue; text-align: center;text-align: center; background: yellow }background: yellow }

Page 9: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSS (cont)Basic syntax Rules of CSS (cont)

Setting CSS rules using body elementSetting CSS rules using body element body { background: yellow; font-style: italic}body { background: yellow; font-style: italic} P {font-family: Verdana; font-size: 12pt}P {font-family: Verdana; font-size: 12pt} H1,H2,H3{color:blue; background: white; H1,H2,H3{color:blue; background: white;

text-align: center}text-align: center}

Page 10: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSS (cont)Basic syntax Rules of CSS (cont)

Background colorsBackground colors body {background: yellow; color: green}body {background: yellow; color: green} H1, p {background: white; color: blue}H1, p {background: white; color: blue} P B,UL {color: red}P B,UL {color: red}

Page 11: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Basic syntax Rules of CSS (cont)Basic syntax Rules of CSS (cont)

Setting colors for linksSetting colors for links a: link {color: blue; text-decoration: none}a: link {color: blue; text-decoration: none} a: visited {color: red}a: visited {color: red} a: active {color: green}a: active {color: green} a: hover {color: yellow}a: hover {color: yellow}

Page 12: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Linking CSS to html documentsLinking CSS to html documents

There are several ways to link CSS to html There are several ways to link CSS to html documentsdocuments

-Inline linking-Inline linking -Internal linking-Internal linking -Linking to an external style sheets-Linking to an external style sheets

Page 13: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Example of Inline linkingExample of Inline linking

Page 14: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Inline linking resultInline linking result

Page 15: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Internal LinkingInternal Linking Apply using style Apply using style

elementselements

Page 16: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

ResultResult

Page 17: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Class attributeClass attribute Example of CSS Class attribute Example of CSS Class attribute

rulesrules

Page 18: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

ResultResult

Page 19: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

More example of class attributeMore example of class attribute Example of Example of

border/List rulesborder/List rules

Page 20: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Class attribute (cont)Class attribute (cont)

Page 21: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

ResultResult

Page 22: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Linking to an externalLinking to an external Example of Linking to Example of Linking to

an external filesan external files

Page 23: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

TestStyle.cssTestStyle.css

Page 24: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

ResultResult

Page 25: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Browsers and CSSBrowsers and CSS Most browsers support CSSMost browsers support CSS for instance, Microsoft internet for instance, Microsoft internet

Explorer 4(IE4), Netscape Explorer 4(IE4), Netscape navigator4(NS4) and Opera navigator4(NS4) and Opera 3.5(O3.5) support CSS3.5(O3.5) support CSS

Some browsers don’t support CSSSome browsers don’t support CSS for instance, Netscape’s for instance, Netscape’s

Navigator 1 and Microsoft Internet Navigator 1 and Microsoft Internet Explorer 2 don’t support CSS Explorer 2 don’t support CSS style. The browsers that don’t style. The browsers that don’t support CSS just ignore the style support CSS just ignore the style but display the contents of the but display the contents of the style on the screen which is not style on the screen which is not necessary. necessary.

Page 26: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Browser and CSS (cont)Browser and CSS (cont)

Page 27: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Advantages of CSSAdvantages of CSS Web pages will load faster because of the Web pages will load faster because of the

reduced redundant coding from each pagereduced redundant coding from each page Allows designers to change colors, fonts, etc.Allows designers to change colors, fonts, etc. Easier to update web site designs.Easier to update web site designs. More control over your pageMore control over your page Structured contents in your web document and Structured contents in your web document and

well organizedwell organized Allows shared style sheets across multiple Allows shared style sheets across multiple

documentsdocuments Reduced design/development timeReduced design/development time

Page 28: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Disadvantages of CSSDisadvantages of CSS It is not understood by some of the browsersIt is not understood by some of the browsers It can mess up your pages if you don’t be carefulIt can mess up your pages if you don’t be careful

Page 29: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

ConclusionConclusion

CSS improves the look and feel of your CSS improves the look and feel of your web page designsweb page designs

Reduce coding timeReduce coding time I recommend it I recommend it

Page 30: CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS

Questions Questions