Introduction to CSS
CSS Defined: Short for "Cascading Style Sheets". Determines how the elements in our XHTML documents are displayed and formatted. Designed to separate the  content  of a web page from the  presentation  of that content. Enables us to make all pages of our website look similar and consistent (font, color, etc.). Allows us to make site-wide formatting changes from a single location (rather than having to edit each page individually).
Three Ways to Use CSS: Inline Style - CSS is placed directly into the XHTML element. Internal Style Sheet - CSS is placed into a separate area within the <head> section of a web page. External Style Sheet - CSS is placed into a separate computer file and &quot;connected&quot; to a web page.
CSS Format Conflicts: It's possible for CSS formatting to be defined in all three locations at the same time.  For example, a paragraph element could contain an inline style (color:red) but the internal style sheet (color:blue) and the external style sheet (color:green) give conflicting instructions to the web browser. Web browsers need a consistent way of &quot;settling&quot; this disagreement.
What is Meant by &quot;Cascading&quot;? We use the term cascading because there is an established order of priority to resolve these formatting conflicts: Inline style (highest priority) Internal style sheet (second priority) External style sheet (third priority) Web browser default (only if not defined elsewhere) For each XHTML element, the browser will check to see which inline styles are defined, then those styles in the internal style sheet, and finally those styles in the external sheet.  For all conflicts, it will use this priority system to determine which format to display on the page. In the prior example, the paragraph would display as red, because the inline style &quot;outranks&quot; all the others.
Example: Inline Style <h2  style=&quot;font-family:georgia; color:red;&quot; > CAUTION: Stormy Weather! </h2> An inline style declaration like this one will affect  only that particular element .  In other words, other <h2> elements on the page will not be affected by this formatting. A semicolon must follow each style declaration. Because inline styles do not properly separate content and presentation, their use is discouraged.  We will not be using inline styles in this class. PREVIEW:
Example: Internal Style Sheet <head> <style type=&quot;text/css&quot;> h2 {font-family:georgia; color:red;} </style> </head> Styles declared in the internal style sheet will affect  all matching elements on the page .  In this example, all <h2> elements on the page will be displayed in Georgia font and in red color. For internal style sheets, all formatting declarations are placed inside the <style> element within the <head> section of the document.  An element is listed and all the styling information follows, surrounded by opening and closing curly brackets,  { } . A semicolon must still follow each style declaration.
Example: External Style Sheet <head> <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style.css&quot; /> </head> Styles declared in an external style sheet will affect  all matching elements on all web pages that link to the stylesheet .  In this example, all <h2> elements on all pages using this style sheet will be displayed in Georgia font and in red color. For external style sheets, a <link> tag is placed at the beginning of the <head> section of the document specifying the external style sheet (with a .css extension) to be used for formatting.  The external style sheet uses the same syntax as the internal style sheet when listing elements and their styling. h2 {font-family:georgia; color:red;} style.css (separate file):
Internal vs. External Style Sheets Internal style sheets are appropriate for very small sites, especially those that have just one page. Internal style sheets might also make sense when each page of a site needs to have a completely different look. External style sheets are better for multi-page websites that need to have a uniform look and feel to all pages. External style sheets not only make for faster-loading sites (less redundant code) but also allow designers to make site-wide changes quickly and easily.
CSS Terminology and Syntax: p  {color:red;} Correct syntax: selector {property:value;} Selector Property Value Be careful to put the semicolon after each declaration.  It is the single most common mistake made by those learning CSS.
Setting Multiple Properties: p {  color:red;  font-style:italic; text-align:center; } Many designers choose to place the selector and the open bracket on a dedicated line and the closing bracket on its own line too.  By doing this, all the selectors in between are aligned and easy to read. You can define as many selectors as you wish for the element you are formatting. In the above example, all paragraph elements will now show red italic text that is centered on the page.
Setting a Background with CSS: body { background-image:url('picture.gif'); background-repeat:repeat-x; background-color:red; } With background-image, you can specify an image to be placed in the background of your web page. If you specify a background image, you can also decide whether the image will &quot;tile&quot; across or down the screen.  Possible values for the background-repeat property include repeat-x (horizontally only), repeat-y (vertical only), and no-repeat (no tiling at all).  If you don't specify this property at all, by default the image will repeat up and down to fill the entire page. You can use the background-color property to set one solid color for the background.  Even if you specify a background image, it is good practice to specify a color too.  If for some reason the background image is not available, the background color will be shown instead.
CSS Text Properties: The following properties can be specified for any element that contains text, such as <h1> thru <h6>, <p>, <ol>, <ul>, and <a>: Property Some Possible Values text-align:  center, left, right, justify text-decoration: underline, line-through, blink color: blue, green, yellow, red, white, etc. font-family: Arial, Verdana, &quot;Times New Roman&quot; font-size: large, 120%, 20px (pixels)    font-weight: bold, normal font-style: italic, normal For a full list of available color names, refer to the following page: http://www.w3.org/TR/css3-color/#svg-color

More Related Content

PPT
CSS for Beginners
PPT
cascading style sheet ppt
PPT
Introduction to css by programmerblog.net
PPT
CSS Basics
PPTX
Css module1
ODP
ODP
Introduction to css & its attributes with syntax
PPT
Html mod1
CSS for Beginners
cascading style sheet ppt
Introduction to css by programmerblog.net
CSS Basics
Css module1
Introduction to css & its attributes with syntax
Html mod1

What's hot (20)

ODP
Cascading Style Sheets - Part 01
PPT
Cascading Style Sheet
PPT
Css Ppt
PPT
How Cascading Style Sheets (CSS) Works
PPTX
What is CSS?
PPTX
Css mod1
PPTX
Customizing the Appearance and HTML Output of Visualforce Pages
PPTX
Creating a webpage in html
PPT
PPT
PPTX
Cascading style sheet
DOC
Css introduction
PPT
Introduction to Cascading Style Sheets
PPTX
How to create a html webpage using notepad
PPTX
Css types internal, external and inline (1)
PPT
Chapter 4a cascade style sheet css
PPTX
PPT
Basics Of Css And Some Common Mistakes
PPTX
Css Basics
Cascading Style Sheets - Part 01
Cascading Style Sheet
Css Ppt
How Cascading Style Sheets (CSS) Works
What is CSS?
Css mod1
Customizing the Appearance and HTML Output of Visualforce Pages
Creating a webpage in html
Cascading style sheet
Css introduction
Introduction to Cascading Style Sheets
How to create a html webpage using notepad
Css types internal, external and inline (1)
Chapter 4a cascade style sheet css
Basics Of Css And Some Common Mistakes
Css Basics
Ad

Viewers also liked (20)

PDF
Introduction 2 css
PPTX
Komonvelt portoriko
PPTX
Špoģi-Syke
PPT
7.1 xhtml validation
PPTX
[Gmic]nale be cubbying
PPTX
Presentation 10
PPT
6.1 special characters
PPTX
Ultimate frisbee
PPS
Osnove windows-a
PPTX
Java ders2
PPTX
Another world (1) The author Ilze
PPTX
Dress from newspapers_-_copy (1)
PPTX
Global dimension in social sciences subjects in formal
PPT
3.2 introduction to css
PPT
2.1 adding images
PDF
American Campaign to supress Islam
PPTX
Marathon Oil Corp. Industry Profile
DOCX
Fstpt 15-solo-english
PPT
Questionaire all-teachers-2011
PPT
Geo gebra u1
Introduction 2 css
Komonvelt portoriko
Špoģi-Syke
7.1 xhtml validation
[Gmic]nale be cubbying
Presentation 10
6.1 special characters
Ultimate frisbee
Osnove windows-a
Java ders2
Another world (1) The author Ilze
Dress from newspapers_-_copy (1)
Global dimension in social sciences subjects in formal
3.2 introduction to css
2.1 adding images
American Campaign to supress Islam
Marathon Oil Corp. Industry Profile
Fstpt 15-solo-english
Questionaire all-teachers-2011
Geo gebra u1
Ad

Similar to 3.2 introduction to css (20)

PPTX
Introduction to CSS
PDF
TUTORIAL DE CSS 2.0
PPTX
HTML to CSS Basics Exer 2.pptx
PDF
CSS notes
PPTX
Web Programming-css.pptx
PPTX
properties of css.pptx power pointpresentation
PPT
Css 2010
PPT
Css 2010
PPTX
Lecture-6.pptx
PPT
PPTX
ODP
Css.prabu
PPTX
Unit 2 Internet and web technology CSS report
PPTX
PPT
Introduction to CSS
TUTORIAL DE CSS 2.0
HTML to CSS Basics Exer 2.pptx
CSS notes
Web Programming-css.pptx
properties of css.pptx power pointpresentation
Css 2010
Css 2010
Lecture-6.pptx
Css.prabu
Unit 2 Internet and web technology CSS report

More from Bulldogs83 (15)

PPT
7.2 external style sheets
PPT
6.2 css link styling
PPT
5.2 nesting and floating elements
PPT
5.1 css box model
PPT
4.3 table styling
PPT
4.2 css classes
PPT
4.1 advanced tables
PPT
3.1 xhtml tables
PPT
1.4 adding comments copy (2)
PPT
1.4 adding comments copy (2)
PPT
1.3 creating links
PPT
1.3 creating links
PPT
1.2 elements and attributes copy (3)
PPT
1.2 elements and attributes copy (3)
PPT
1.1 xhtml basics
7.2 external style sheets
6.2 css link styling
5.2 nesting and floating elements
5.1 css box model
4.3 table styling
4.2 css classes
4.1 advanced tables
3.1 xhtml tables
1.4 adding comments copy (2)
1.4 adding comments copy (2)
1.3 creating links
1.3 creating links
1.2 elements and attributes copy (3)
1.2 elements and attributes copy (3)
1.1 xhtml basics

Recently uploaded (20)

PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
PPTX
Approach to a child with acute kidney injury
PPTX
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
PPTX
climate change of delhi impacts on climate and there effects
PPTX
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
PDF
[Medicalstudyzone.com] 1. AIIMS NOV EMBER 2015 SOLVED PAPER.pdf
PDF
Jana-Ojana Finals 2025 - School Quiz by Pragya - UEMK Quiz Club
PDF
The 10 Most Inspiring Education Leaders to Follow in 2025.pdf
PDF
Unleashing the Potential of the Cultural and creative industries
PPTX
MMW-CHAPTER-1-final.pptx major Elementary Education
PDF
gsas-cvs-and-cover-letters jhvgfcffttfghgvhg.pdf
PDF
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
PPTX
MALARIA - educational ppt for students..
PDF
FAMILY PLANNING (preventative and social medicine pdf)
PDF
Developing speaking skill_learning_mater.pdf
PDF
Physical pharmaceutics two in b pharmacy
PDF
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
PPTX
macro complete discussion with given activities
PDF
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
PDF
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
Approach to a child with acute kidney injury
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
climate change of delhi impacts on climate and there effects
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
[Medicalstudyzone.com] 1. AIIMS NOV EMBER 2015 SOLVED PAPER.pdf
Jana-Ojana Finals 2025 - School Quiz by Pragya - UEMK Quiz Club
The 10 Most Inspiring Education Leaders to Follow in 2025.pdf
Unleashing the Potential of the Cultural and creative industries
MMW-CHAPTER-1-final.pptx major Elementary Education
gsas-cvs-and-cover-letters jhvgfcffttfghgvhg.pdf
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
MALARIA - educational ppt for students..
FAMILY PLANNING (preventative and social medicine pdf)
Developing speaking skill_learning_mater.pdf
Physical pharmaceutics two in b pharmacy
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
macro complete discussion with given activities
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...

3.2 introduction to css

  • 2. CSS Defined: Short for &quot;Cascading Style Sheets&quot;. Determines how the elements in our XHTML documents are displayed and formatted. Designed to separate the content of a web page from the presentation of that content. Enables us to make all pages of our website look similar and consistent (font, color, etc.). Allows us to make site-wide formatting changes from a single location (rather than having to edit each page individually).
  • 3. Three Ways to Use CSS: Inline Style - CSS is placed directly into the XHTML element. Internal Style Sheet - CSS is placed into a separate area within the <head> section of a web page. External Style Sheet - CSS is placed into a separate computer file and &quot;connected&quot; to a web page.
  • 4. CSS Format Conflicts: It's possible for CSS formatting to be defined in all three locations at the same time. For example, a paragraph element could contain an inline style (color:red) but the internal style sheet (color:blue) and the external style sheet (color:green) give conflicting instructions to the web browser. Web browsers need a consistent way of &quot;settling&quot; this disagreement.
  • 5. What is Meant by &quot;Cascading&quot;? We use the term cascading because there is an established order of priority to resolve these formatting conflicts: Inline style (highest priority) Internal style sheet (second priority) External style sheet (third priority) Web browser default (only if not defined elsewhere) For each XHTML element, the browser will check to see which inline styles are defined, then those styles in the internal style sheet, and finally those styles in the external sheet. For all conflicts, it will use this priority system to determine which format to display on the page. In the prior example, the paragraph would display as red, because the inline style &quot;outranks&quot; all the others.
  • 6. Example: Inline Style <h2 style=&quot;font-family:georgia; color:red;&quot; > CAUTION: Stormy Weather! </h2> An inline style declaration like this one will affect only that particular element . In other words, other <h2> elements on the page will not be affected by this formatting. A semicolon must follow each style declaration. Because inline styles do not properly separate content and presentation, their use is discouraged. We will not be using inline styles in this class. PREVIEW:
  • 7. Example: Internal Style Sheet <head> <style type=&quot;text/css&quot;> h2 {font-family:georgia; color:red;} </style> </head> Styles declared in the internal style sheet will affect all matching elements on the page . In this example, all <h2> elements on the page will be displayed in Georgia font and in red color. For internal style sheets, all formatting declarations are placed inside the <style> element within the <head> section of the document. An element is listed and all the styling information follows, surrounded by opening and closing curly brackets, { } . A semicolon must still follow each style declaration.
  • 8. Example: External Style Sheet <head> <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style.css&quot; /> </head> Styles declared in an external style sheet will affect all matching elements on all web pages that link to the stylesheet . In this example, all <h2> elements on all pages using this style sheet will be displayed in Georgia font and in red color. For external style sheets, a <link> tag is placed at the beginning of the <head> section of the document specifying the external style sheet (with a .css extension) to be used for formatting. The external style sheet uses the same syntax as the internal style sheet when listing elements and their styling. h2 {font-family:georgia; color:red;} style.css (separate file):
  • 9. Internal vs. External Style Sheets Internal style sheets are appropriate for very small sites, especially those that have just one page. Internal style sheets might also make sense when each page of a site needs to have a completely different look. External style sheets are better for multi-page websites that need to have a uniform look and feel to all pages. External style sheets not only make for faster-loading sites (less redundant code) but also allow designers to make site-wide changes quickly and easily.
  • 10. CSS Terminology and Syntax: p {color:red;} Correct syntax: selector {property:value;} Selector Property Value Be careful to put the semicolon after each declaration. It is the single most common mistake made by those learning CSS.
  • 11. Setting Multiple Properties: p { color:red; font-style:italic; text-align:center; } Many designers choose to place the selector and the open bracket on a dedicated line and the closing bracket on its own line too. By doing this, all the selectors in between are aligned and easy to read. You can define as many selectors as you wish for the element you are formatting. In the above example, all paragraph elements will now show red italic text that is centered on the page.
  • 12. Setting a Background with CSS: body { background-image:url('picture.gif'); background-repeat:repeat-x; background-color:red; } With background-image, you can specify an image to be placed in the background of your web page. If you specify a background image, you can also decide whether the image will &quot;tile&quot; across or down the screen. Possible values for the background-repeat property include repeat-x (horizontally only), repeat-y (vertical only), and no-repeat (no tiling at all). If you don't specify this property at all, by default the image will repeat up and down to fill the entire page. You can use the background-color property to set one solid color for the background. Even if you specify a background image, it is good practice to specify a color too. If for some reason the background image is not available, the background color will be shown instead.
  • 13. CSS Text Properties: The following properties can be specified for any element that contains text, such as <h1> thru <h6>, <p>, <ol>, <ul>, and <a>: Property Some Possible Values text-align: center, left, right, justify text-decoration: underline, line-through, blink color: blue, green, yellow, red, white, etc. font-family: Arial, Verdana, &quot;Times New Roman&quot; font-size: large, 120%, 20px (pixels) font-weight: bold, normal font-style: italic, normal For a full list of available color names, refer to the following page: http://www.w3.org/TR/css3-color/#svg-color