SlideShare a Scribd company logo
Week 3 css
CSS - what? Cascade Style Sheets Defines how to display HTML elements (fonts, size, colors, background images, border, styles) Add to HTML 4.0 Stored in CSS files All browsers support CSS Defined by the World Wide Web consortium (W3C) CSS Website Example http:// www.csszengarden.com /
CSS - why??? Advantages Saves time editing (define once on the element, next time the elements will automatically defined) Page load faster Easy maintenance Superior styles to HTML (much wider array of attributes) Disadvantage Browser compatibility
syntax A CSS rule has two main parts: a selector, and one or more declarations The selector is the HTML element you want to style. Each declaration consists of a property and a value. The property is the style attribute you want to change. Each property has a value.
how to ?? Text editors Notepad/WordPad for Windows; TextEdit for Mac Dreamweaver has a function embedded into the program. Comments /* This is for CSS. */  Grouping h1, h2, h3 {color: blue;} Applying multiple properties h1 {color: blue; font-size: 150%; font-family: arial, Helvetica, “sans serif”; }
inline and internal styles  <html> <head>  <title>Project One</title> </head>    < body    >  <p  > This is a red page. </p>  </body> </html>  <style type=&quot;text/css&quot;> body {background-color: #ff0000;} p {color: blue; margin-left:20px;} </style> style=&quot;background-color: #ff0000;&quot; style=&quot;color:blue;margin-left:20px ;&quot;
external style (1) Create a text file and save as .css Create a link in HTML document The css style sheet contains only styles
external style – where to put it?
p{margin-left:20px;} body{background-color:#ff0000;}  external style – how to write it? mystyle.css project.html <html> <head>  <title>Project One</title> <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot;  href=“mystyle.css&quot; /> </head> <body> ...
cascade order Styles can be specified: Inside an HTML element (in-line) Inside the head section of an HTML page (internal) In an external CSS style sheet (external) All the styles will cascade into a new style sheet by the following rules, where number 1 has the highest priority: inline style internal style external style browser default
CSS code reference Text Color body {color:blue} h1 {color:#00ff00} h2 {color:rgb(255,0,0)} Text Alignment h1 {text-align:center} p.date {text-align:right} p.main {text-align:justify}  Text Decoration h1 {text-decoration:overline} h2 {text-decoration:line-through} h3 {text-decoration:underline} h4 {text-decoration:blink}
CSS code reference font p { font-style: italic; font-weight: bold; font-size: 30px; font-family: arial, sans-serif;} Using the short hand property, the code can be simplified: p { font: italic bold 30px arial, sans-serif; }
CSS code reference link  a:link  {color: blue;} (unvisited link) a:visited  {color: red;} a:active  {background-color: #ffff00;}   (active link) a:hover  {color: orange; font-style: italic;  letter-spacing: 10px; font-weight:bold;  text-transform: uppercase;  background-color:yellow;}
4 selector types Tag: re-define an existing HTML element ID:  applies to only one HTML element Class:  applies to any HTML element Compound:  used to combine two or more style rules to create a style definition that displays only when one style is contained within another.  Read:  CSS selectors: tags, ID, class and compound
tag
ID  #id 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 &quot;#&quot;. <html> <head> <style type=&quot;text/css&quot;> #para1 {text-align:center; color:red;}  </style> </head> <body> <p  id=&quot;para1&quot; >Hello World!</p> <p>This paragraph is not affected.</p> </body> </html> Hello World! This paragraph is not affected. P P P P
CLASS  .classname used to specify a style for different elements.  allows you to set a particular style for any html elements with the same class.  uses the html class attribute, and is defined with a &quot;.&quot; P h1 h4 h2
CLASS (example) <html> <head> <style type=&quot;text/css&quot;> .center{text-align:center;} </style> </head> <body> <h1  class=&quot;center&quot; >center-aligned heading</h1> <p  class=&quot;center&quot; >center-aligned paragraph.</p>  /body> </html> center-aligned heading center-aligned paragraph.
recap 3 places inline internal style (between <head></head>) external style (save as .css, html links in the head section) Selectors tag style (applies globally to an individual HTML tag) Id style (format a unique item on a page) class style (format more than 1 item at the same time) compound style
Set up the working space Click  Window  tab > click  CSS style  to open CSS panel On Properties panel, choose  CSS  tab
create a new CSS style CSS style panel highlight the text or image or table +  add new CSS rule >selector (class, id, tag, or compound) name internal or external or defined .css file define elements Properties Panel click  CSS  mode highlight the text or image targeted rule:  new CSS rule>edit rule> open a window > choose the appropriate selector - class, id, tag, or compound > name it  define the elements
apply existing styles Properties Panel For non-text elements, find  class   button and click the arrow, choose the existing  class  from the list; For text elements, click  CSS mode> targeted rule , choose the existing class from the list.
remove a style Property panel: <HTML> mode >class>none or <CSS> mode> targeted rule>remove class ** It only remove the style form the item, but the class is still there.
style, style, more style Edit Styles Find the rule in CSS panel Click on it Change it in the window Rename a class style Properties Panel > class menu>rename or Right click the rule in CSS panel Duplicate a style CSS style panel > right click the style name> duplicate
Link to an existing CSS style sheet Open the HTML file CSS style panel>attach style sheet >browse>all media Attach style sheet button This is your .css file name.

More Related Content

PPTX
CSS Basics (Cascading Style Sheet)
PPT
Cascading Style Sheet | CSS
PPTX
Cascading Style Sheet
DOC
Css introduction
PDF
Introduction to css
PPTX
Css Basics
PPTX
Cascading style sheet
CSS Basics (Cascading Style Sheet)
Cascading Style Sheet | CSS
Cascading Style Sheet
Css introduction
Introduction to css
Css Basics
Cascading style sheet

What's hot (20)

ODP
PPTX
Css intro
PPT
INFO3775 Chapter 2 Part 2
PDF
CSS in HTML
PPTX
chitra
PDF
Intro to HTML
PPTX
ODP
CSS Basics
PPT
Basics Of Css And Some Common Mistakes
PPTX
PPTX
Design Dream
PPTX
Class6
PDF
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
PPT
Chapter 4a cascade style sheet css
PDF
HTML Email
PPTX
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
Css intro
INFO3775 Chapter 2 Part 2
CSS in HTML
chitra
Intro to HTML
CSS Basics
Basics Of Css And Some Common Mistakes
Design Dream
Class6
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Chapter 4a cascade style sheet css
HTML Email
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
Ad

Viewers also liked (20)

PPT
Week5 ap forms
PPTX
Week7 Dreamweaver Behavior & Image Hotspots
PPT
Week1 Dreamweaver and Server
PPT
Social media as a widget
PPTX
PPTX
Web 2.0: its impact on library services
PPT
Social and Mobile Media in the Librarian Profession
PPT
Hybrid in 5 minutes
PPTX
Week 2 HTML lists, hyperlinks, tables, and images
PPTX
Week1 Introduction
PPT
Week 2
PPT
JavaScript
PDF
Meet your 2014 Growth Engine: Subscription Revenues
PDF
3 Findings that Can Get Your Customer Revenue Back on the Path to Growth [Inf...
PDF
Customer success on salesforce platform dreamforce 2014
PDF
Find New Revenue with Existing Customers
PDF
Tribe Night Slidshare Presentation
PDF
Dreamforce 2013 One Hit Wonder Sessions
PPTX
Trabajo de majo
PPTX
social work
Week5 ap forms
Week7 Dreamweaver Behavior & Image Hotspots
Week1 Dreamweaver and Server
Social media as a widget
Web 2.0: its impact on library services
Social and Mobile Media in the Librarian Profession
Hybrid in 5 minutes
Week 2 HTML lists, hyperlinks, tables, and images
Week1 Introduction
Week 2
JavaScript
Meet your 2014 Growth Engine: Subscription Revenues
3 Findings that Can Get Your Customer Revenue Back on the Path to Growth [Inf...
Customer success on salesforce platform dreamforce 2014
Find New Revenue with Existing Customers
Tribe Night Slidshare Presentation
Dreamforce 2013 One Hit Wonder Sessions
Trabajo de majo
social work
Ad

Similar to Week3 css (20)

PPT
Introduction to Cascading Style Sheets
PPT
CSS Part I
PPT
cascading style sheet ppt
PDF
CSCADING style sheet. Internal external inline
PDF
css-ppt.pdf
PDF
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
PPT
AK css
PPT
CSS 101
PPT
PDF
ODP
Cascading Style Sheets - Part 01
PPTX
PPT
ch04-css-basics_final.ppt
PPTX
basic programming language AND HTML CSS JAVApdf
Introduction to Cascading Style Sheets
CSS Part I
cascading style sheet ppt
CSCADING style sheet. Internal external inline
css-ppt.pdf
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
AK css
CSS 101
Cascading Style Sheets - Part 01
ch04-css-basics_final.ppt
basic programming language AND HTML CSS JAVApdf

Recently uploaded (20)

PDF
01-Introduction-to-Information-Management.pdf
PPTX
master seminar digital applications in india
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Cell Types and Its function , kingdom of life
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Pre independence Education in Inndia.pdf
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
01-Introduction-to-Information-Management.pdf
master seminar digital applications in india
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Complications of Minimal Access Surgery at WLH
Cell Types and Its function , kingdom of life
Insiders guide to clinical Medicine.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
102 student loan defaulters named and shamed – Is someone you know on the list?
Anesthesia in Laparoscopic Surgery in India
Microbial disease of the cardiovascular and lymphatic systems
Supply Chain Operations Speaking Notes -ICLT Program
Pre independence Education in Inndia.pdf
Basic Mud Logging Guide for educational purpose
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf

Week3 css

  • 2. CSS - what? Cascade Style Sheets Defines how to display HTML elements (fonts, size, colors, background images, border, styles) Add to HTML 4.0 Stored in CSS files All browsers support CSS Defined by the World Wide Web consortium (W3C) CSS Website Example http:// www.csszengarden.com /
  • 3. CSS - why??? Advantages Saves time editing (define once on the element, next time the elements will automatically defined) Page load faster Easy maintenance Superior styles to HTML (much wider array of attributes) Disadvantage Browser compatibility
  • 4. syntax A CSS rule has two main parts: a selector, and one or more declarations The selector is the HTML element you want to style. Each declaration consists of a property and a value. The property is the style attribute you want to change. Each property has a value.
  • 5. how to ?? Text editors Notepad/WordPad for Windows; TextEdit for Mac Dreamweaver has a function embedded into the program. Comments /* This is for CSS. */ Grouping h1, h2, h3 {color: blue;} Applying multiple properties h1 {color: blue; font-size: 150%; font-family: arial, Helvetica, “sans serif”; }
  • 6. inline and internal styles <html> <head> <title>Project One</title> </head> < body > <p > This is a red page. </p> </body> </html> <style type=&quot;text/css&quot;> body {background-color: #ff0000;} p {color: blue; margin-left:20px;} </style> style=&quot;background-color: #ff0000;&quot; style=&quot;color:blue;margin-left:20px ;&quot;
  • 7. external style (1) Create a text file and save as .css Create a link in HTML document The css style sheet contains only styles
  • 8. external style – where to put it?
  • 9. p{margin-left:20px;} body{background-color:#ff0000;} external style – how to write it? mystyle.css project.html <html> <head> <title>Project One</title> <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=“mystyle.css&quot; /> </head> <body> ...
  • 10. cascade order Styles can be specified: Inside an HTML element (in-line) Inside the head section of an HTML page (internal) In an external CSS style sheet (external) All the styles will cascade into a new style sheet by the following rules, where number 1 has the highest priority: inline style internal style external style browser default
  • 11. CSS code reference Text Color body {color:blue} h1 {color:#00ff00} h2 {color:rgb(255,0,0)} Text Alignment h1 {text-align:center} p.date {text-align:right} p.main {text-align:justify} Text Decoration h1 {text-decoration:overline} h2 {text-decoration:line-through} h3 {text-decoration:underline} h4 {text-decoration:blink}
  • 12. CSS code reference font p { font-style: italic; font-weight: bold; font-size: 30px; font-family: arial, sans-serif;} Using the short hand property, the code can be simplified: p { font: italic bold 30px arial, sans-serif; }
  • 13. CSS code reference link a:link {color: blue;} (unvisited link) a:visited {color: red;} a:active {background-color: #ffff00;} (active link) a:hover {color: orange; font-style: italic; letter-spacing: 10px; font-weight:bold; text-transform: uppercase; background-color:yellow;}
  • 14. 4 selector types Tag: re-define an existing HTML element ID: applies to only one HTML element Class: applies to any HTML element Compound: used to combine two or more style rules to create a style definition that displays only when one style is contained within another. Read: CSS selectors: tags, ID, class and compound
  • 15. tag
  • 16. ID #id 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 &quot;#&quot;. <html> <head> <style type=&quot;text/css&quot;> #para1 {text-align:center; color:red;} </style> </head> <body> <p id=&quot;para1&quot; >Hello World!</p> <p>This paragraph is not affected.</p> </body> </html> Hello World! This paragraph is not affected. P P P P
  • 17. CLASS .classname used to specify a style for different elements. allows you to set a particular style for any html elements with the same class. uses the html class attribute, and is defined with a &quot;.&quot; P h1 h4 h2
  • 18. CLASS (example) <html> <head> <style type=&quot;text/css&quot;> .center{text-align:center;} </style> </head> <body> <h1 class=&quot;center&quot; >center-aligned heading</h1> <p class=&quot;center&quot; >center-aligned paragraph.</p> /body> </html> center-aligned heading center-aligned paragraph.
  • 19. recap 3 places inline internal style (between <head></head>) external style (save as .css, html links in the head section) Selectors tag style (applies globally to an individual HTML tag) Id style (format a unique item on a page) class style (format more than 1 item at the same time) compound style
  • 20. Set up the working space Click Window tab > click CSS style to open CSS panel On Properties panel, choose CSS tab
  • 21. create a new CSS style CSS style panel highlight the text or image or table + add new CSS rule >selector (class, id, tag, or compound) name internal or external or defined .css file define elements Properties Panel click CSS mode highlight the text or image targeted rule: new CSS rule>edit rule> open a window > choose the appropriate selector - class, id, tag, or compound > name it define the elements
  • 22. apply existing styles Properties Panel For non-text elements, find class button and click the arrow, choose the existing class from the list; For text elements, click CSS mode> targeted rule , choose the existing class from the list.
  • 23. remove a style Property panel: <HTML> mode >class>none or <CSS> mode> targeted rule>remove class ** It only remove the style form the item, but the class is still there.
  • 24. style, style, more style Edit Styles Find the rule in CSS panel Click on it Change it in the window Rename a class style Properties Panel > class menu>rename or Right click the rule in CSS panel Duplicate a style CSS style panel > right click the style name> duplicate
  • 25. Link to an existing CSS style sheet Open the HTML file CSS style panel>attach style sheet >browse>all media Attach style sheet button This is your .css file name.