SlideShare une entreprise Scribd logo
1  sur  13
Introduction to CSS
CSS Defined: ,[object Object],[object Object],[object Object],[object Object],[object Object]
Three Ways to Use CSS: ,[object Object],[object Object],[object Object]
CSS Format Conflicts: ,[object Object],[object Object]
What is Meant by "Cascading"? ,[object Object],[object Object],[object Object],[object Object],[object Object],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 "outranks" 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 ,[object Object],[object Object],[object Object],[object Object]
CSS Terminology and Syntax: ,[object Object],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: ,[object Object],[object Object],[object Object],[object Object],[object Object],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

Contenu connexe

Tendances

Creating a webpage in html
Creating a webpage in htmlCreating a webpage in html
Creating a webpage in html
Shrey Goswami
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 
Basics Of Css And Some Common Mistakes
Basics Of Css And Some Common MistakesBasics Of Css And Some Common Mistakes
Basics Of Css And Some Common Mistakes
sanjay2211
 

Tendances (20)

Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
What is CSS?
What is CSS?What is CSS?
What is CSS?
 
Css mod1
Css mod1Css mod1
Css mod1
 
Customizing the Appearance and HTML Output of Visualforce Pages
Customizing the Appearance and HTML Output of VisualforcePages Customizing the Appearance and HTML Output of VisualforcePages
Customizing the Appearance and HTML Output of Visualforce Pages
 
Creating a webpage in html
Creating a webpage in htmlCreating a webpage in html
Creating a webpage in html
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
CSS
CSSCSS
CSS
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Css
CssCss
Css
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
Introduction to Cascading Style Sheets
Introduction to Cascading Style SheetsIntroduction to Cascading Style Sheets
Introduction to Cascading Style Sheets
 
How to create a html webpage using notepad
How to create a html webpage using notepadHow to create a html webpage using notepad
How to create a html webpage using notepad
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
CSS - LinkedIn
CSS - LinkedInCSS - LinkedIn
CSS - LinkedIn
 
Basics Of Css And Some Common Mistakes
Basics Of Css And Some Common MistakesBasics Of Css And Some Common Mistakes
Basics Of Css And Some Common Mistakes
 
Css Basics
Css BasicsCss Basics
Css Basics
 

En vedette (20)

1.2 elements and attributes copy (3)
1.2 elements and attributes   copy (3)1.2 elements and attributes   copy (3)
1.2 elements and attributes copy (3)
 
Culture Of Pakistan
Culture Of PakistanCulture Of Pakistan
Culture Of Pakistan
 
Kamal b'day
Kamal b'dayKamal b'day
Kamal b'day
 
Energy questionnaire
Energy questionnaireEnergy questionnaire
Energy questionnaire
 
LETRA I
LETRA ILETRA I
LETRA I
 
Pmk no. 1796 ttg registrasi tenaga kesehatan
Pmk no. 1796 ttg registrasi tenaga kesehatanPmk no. 1796 ttg registrasi tenaga kesehatan
Pmk no. 1796 ttg registrasi tenaga kesehatan
 
Another world (2)- Aļona
Another world (2)-  AļonaAnother world (2)-  Aļona
Another world (2)- Aļona
 
Recycling
RecyclingRecycling
Recycling
 
Mūžizglītības programmas comenius apkašprogrammas
Mūžizglītības programmas comenius apkašprogrammasMūžizglītības programmas comenius apkašprogrammas
Mūžizglītības programmas comenius apkašprogrammas
 
1.4 adding comments copy (2)
1.4 adding comments   copy (2)1.4 adding comments   copy (2)
1.4 adding comments copy (2)
 
Power u
Power uPower u
Power u
 
Power e
Power ePower e
Power e
 
Komonvelt portoriko
Komonvelt portorikoKomonvelt portoriko
Komonvelt portoriko
 
Ajusal
AjusalAjusal
Ajusal
 
3.1 xhtml tables
3.1 xhtml tables3.1 xhtml tables
3.1 xhtml tables
 
STUDENTS' FEEDBACKS
STUDENTS' FEEDBACKSSTUDENTS' FEEDBACKS
STUDENTS' FEEDBACKS
 
Samarbeidsoppgave gr5
Samarbeidsoppgave gr5Samarbeidsoppgave gr5
Samarbeidsoppgave gr5
 
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbiaThis is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
 
You can build anything (Anita Borg 2011)
You can build anything (Anita Borg 2011)You can build anything (Anita Borg 2011)
You can build anything (Anita Borg 2011)
 
Java ders2
Java ders2Java ders2
Java ders2
 

Similaire à 3.2 introduction to css (20)

Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
HTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptxHTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptx
 
CSS notes
CSS notesCSS notes
CSS notes
 
Web Programming-css.pptx
Web Programming-css.pptxWeb Programming-css.pptx
Web Programming-css.pptx
 
CSS
CSSCSS
CSS
 
Css
CssCss
Css
 
Css
CssCss
Css
 
Css 2010
Css 2010Css 2010
Css 2010
 
Css 2010
Css 2010Css 2010
Css 2010
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 
Css.prabu
Css.prabuCss.prabu
Css.prabu
 
CSS
CSSCSS
CSS
 
html-css
html-csshtml-css
html-css
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 
CSS Basic and Common Errors
CSS Basic and Common ErrorsCSS Basic and Common Errors
CSS Basic and Common Errors
 
CSS
CSSCSS
CSS
 

Plus de Bulldogs83

7.2 external style sheets
7.2 external style sheets7.2 external style sheets
7.2 external style sheets
Bulldogs83
 
7.1 xhtml validation
7.1 xhtml validation7.1 xhtml validation
7.1 xhtml validation
Bulldogs83
 
6.2 css link styling
6.2 css link styling6.2 css link styling
6.2 css link styling
Bulldogs83
 
6.1 special characters
6.1 special characters6.1 special characters
6.1 special characters
Bulldogs83
 
5.2 nesting and floating elements
5.2 nesting and floating elements5.2 nesting and floating elements
5.2 nesting and floating elements
Bulldogs83
 
5.1 css box model
5.1 css box model5.1 css box model
5.1 css box model
Bulldogs83
 
4.3 table styling
4.3 table styling4.3 table styling
4.3 table styling
Bulldogs83
 
4.2 css classes
4.2 css classes4.2 css classes
4.2 css classes
Bulldogs83
 
4.1 advanced tables
4.1 advanced tables4.1 advanced tables
4.1 advanced tables
Bulldogs83
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
Bulldogs83
 
2.1 adding images
2.1 adding images2.1 adding images
2.1 adding images
Bulldogs83
 
1.4 adding comments copy (2)
1.4 adding comments   copy (2)1.4 adding comments   copy (2)
1.4 adding comments copy (2)
Bulldogs83
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating links
Bulldogs83
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating links
Bulldogs83
 
1.2 elements and attributes copy (3)
1.2 elements and attributes   copy (3)1.2 elements and attributes   copy (3)
1.2 elements and attributes copy (3)
Bulldogs83
 
1.1 xhtml basics
1.1 xhtml basics1.1 xhtml basics
1.1 xhtml basics
Bulldogs83
 

Plus de Bulldogs83 (16)

7.2 external style sheets
7.2 external style sheets7.2 external style sheets
7.2 external style sheets
 
7.1 xhtml validation
7.1 xhtml validation7.1 xhtml validation
7.1 xhtml validation
 
6.2 css link styling
6.2 css link styling6.2 css link styling
6.2 css link styling
 
6.1 special characters
6.1 special characters6.1 special characters
6.1 special characters
 
5.2 nesting and floating elements
5.2 nesting and floating elements5.2 nesting and floating elements
5.2 nesting and floating elements
 
5.1 css box model
5.1 css box model5.1 css box model
5.1 css box model
 
4.3 table styling
4.3 table styling4.3 table styling
4.3 table styling
 
4.2 css classes
4.2 css classes4.2 css classes
4.2 css classes
 
4.1 advanced tables
4.1 advanced tables4.1 advanced tables
4.1 advanced tables
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
2.1 adding images
2.1 adding images2.1 adding images
2.1 adding images
 
1.4 adding comments copy (2)
1.4 adding comments   copy (2)1.4 adding comments   copy (2)
1.4 adding comments copy (2)
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating links
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating links
 
1.2 elements and attributes copy (3)
1.2 elements and attributes   copy (3)1.2 elements and attributes   copy (3)
1.2 elements and attributes copy (3)
 
1.1 xhtml basics
1.1 xhtml basics1.1 xhtml basics
1.1 xhtml basics
 

Dernier

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Dernier (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 

3.2 introduction to css

  • 2.
  • 3.
  • 4.
  • 5.
  • 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.
  • 10.
  • 11.
  • 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