SlideShare a Scribd company logo
CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics (that is, the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including SVG and XUL.
HISTORY Style sheets have existed in one form or another since the beginnings of SGML in the 1970s. Cascading Style Sheets were developed as a means for creating a consistent approach to providing style information for web documents. As HTML grew, it came to encompass a wider variety of stylistic capabilities to meet the demands of web developers. This evolution gave the designer more control over site appearance but at the cost of HTML becoming more complex to write and maintain. Variations in web browser implementations made consistent site appearance difficult, and users had less control over how web content was displayed.
CSS STYLING
STYLING BACKGROUNDS CSS properties used for background effects: CSS background properties are used to define the background effects of an element. background-color background-image background-repeat background-attachment background-position Background Color The background-color property specifies the background color of an element.The background color of a page is defined in the body selector: Example: body {background-color:#b0c4de;}
STYLING TEXT Text Color The color property is used to set the color of the text. The color can be specified by: name - a color name, like "red" RGB - an RGB value, like "rgb(255,0,0)" Hex - a hex value, like "#ff0000" The default color for a page is defined in the body selector. Example body {color:blue;} h1 {color:#00ff00;} h2 {color:rgb(255,0,0);}
CSS FONT FAMILIES CSS Font Families In CSS, there are two types of font family names: generic family - a group of font families with  a similar look (like "Serif" or "Monospace") font family - a specific font family (like "Times New Roman" or "Arial") Font Style The font-style property is mostly used to specify italic text. This property has three values: normal - The text is shown normally italic - The text is shown in italics oblique - The text is "leaning" (oblique is very similar to italic, but less supported)
CSS BOX MODEL
BOX MODEL The CSS Box Model All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout. The CSS box model is essentially a box that wraps around HTML elements, and it consists of: margins, borders, padding, and the actual content. The box model allows us to place a border around elements and space elements in relation to other elements. The image below illustrates the box model:
BORDER Border Width The border-width property is used to set the width of the border. The width is set in pixels, or by using one of the three pre-defined values: thin, medium, or thick. Border Color The border-color property is used to set the color of the border. The color can be set by: name - specify a color name, like "red" RGB - specify a RGB value, like "rgb(255,0,0)" Hex - specify a hex value, like "#ff0000"
CSS MARGIN The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent.The top, right, bottom, and left margin can be changed independently using separate properties. A shorthand margin property can also be used, to change all margins at once. Possible Values:
CSS PADDING The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.The top, right, bottom, and left padding can be changed independently using separate properties. A shorthand padding property can also be used, to change all paddings at once. Possible Values:
PADDING INDIVIDUAL SLIDES Padding - Individual sides In CSS, it is possible to specify different padding for different sides:
PADDING SHORT HAND PROPERTY To shorten the code, it is possible to specify all the padding properties in one property. This is called a shorthand property.The shorthand property for all the padding properties is "padding": Example: padding:25px 50px; The padding property can have from one to four values. padding:25px 50px 75px 100px; top padding is 25px right padding is 50px bottom padding is 75px left padding is 100px
CSS GROUPING AND NESTING SELECTORS
GROUPING SELECTORS Grouping Selectors In style sheets there are often elements with the same style. To minimize the code, you can group selectors. Separate each selector with a comma. In the example below we have grouped the selectors from the code above:
NESTING SELECTORS Nesting Selectors It is possible to apply a style for a selector within a selector. In the example below, one style is specified for all p elements, and a separate style is specified for p elements nested within the "marked" class:
CSS DISPLAY
CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line break before and after it. Examples of block elements: <h1> <p> <div> An inline element only takes up as much width as necessary, and does not force line breaks. Examples of inline elements: <span> <a>
CSS POSITIONING
Positioning The CSS positioning properties allow you to position an element. It can also place an element behind another, and specify what should happen when an element's content is too big. Elements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the positioning method.
Static Positioning HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page. Static positioned elements are not affected by the top, bottom, left, and right properties.
Fixed Positioning An element with fixed position is positioned relative to the browser window. It will not move even if the window is scrolled:
CSS NAVIGATION BAR
Vertical Navigation Bar To build a vertical navigation bar we only need to style the <a> elements, in addition to the code above:
Horizontal Navigation Bar Horizontal Navigation Bar There are two ways to create a horizontal navigation bar. Using inline or floating list items. Both methods work fine, but if you want the links to be the same size, you have to use the floating method.
CSS MEDIA TYPES Media Types allow you to specify how documents will be presented in different media. The document can be displayed differently on the screen, on the paper, with an aural browser, etc.  Different Media Types: all Used for all media type devices aural Used for speech and sound synthesizers braille Used for braille tactile feedback devices embossed Used for paged braille printers handheld Used for small or handheld devices print Used for printers projection Used for projected presentations, like slides screen Used for computer screens tty Used for media using a fixed-pitch character grid, like teletypes and terminals tv Used for television-type devices
CSS FLOAT An element can be pushed to the left or right, allowing other elements to wrap around it.Float is very often used for images, but it is also useful when working with layouts.
Turning off Float - Using Clear Elements after the floating element will flow around it. To avoid this, use the clear property. The clear property specifies which sides of an element other floating elements are not allowed. EXAMPLE: .text_line { clear:both; }
HOW ELEMENTS FLOAT Elements are floated horizontally, this means that an element can only be floated left or right, not up or down.A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element.The elements after the floating element will flow around it.The elements before the floating element will not be affected.
CSS FLOAT PROPERTIES Property    Description  Values CSS clear Specifies which sides of an element where other floating elements are not allowed left right both none inherit 1 float Specifies whether or not a box should float left right none inherit 1

More Related Content

PPTX
CSS_Day_Three (W3schools)
PPTX
CSS_Day_Two (W3schools)
PPTX
CSS_Day_ONE (W3schools)
PPT
CSS for Beginners
PPTX
CSS - Text Properties
PPTX
Chapter 14: Box Model
PPT
cascading style sheet ppt
CSS_Day_Three (W3schools)
CSS_Day_Two (W3schools)
CSS_Day_ONE (W3schools)
CSS for Beginners
CSS - Text Properties
Chapter 14: Box Model
cascading style sheet ppt

What's hot (20)

PDF
Pemrograman Web 3 - CSS Basic Part 2
PPTX
Chapter 12: CSS Part 2
PPTX
Chapter 13: Colors and Backgrounds
ODP
PPTX
Chapter 11: Intro to CSS
PPT
CSS
PPTX
CSS Walktrough Internship Course
PPTX
Cascading style sheet
PPTX
CSS Basics
DOC
Art of css
PPTX
css.ppt
PPT
Introduction to Cascading Style Sheets (CSS)
PPTX
CSS Cascade Style Sheet
PPTX
Css ppt
PDF
Pemrograman Web 2 - CSS
PPT
Css Founder.com | Cssfounder in
PPT
Html Expression Web
PPTX
PPT
CSS Basics
Pemrograman Web 3 - CSS Basic Part 2
Chapter 12: CSS Part 2
Chapter 13: Colors and Backgrounds
Chapter 11: Intro to CSS
CSS
CSS Walktrough Internship Course
Cascading style sheet
CSS Basics
Art of css
css.ppt
Introduction to Cascading Style Sheets (CSS)
CSS Cascade Style Sheet
Css ppt
Pemrograman Web 2 - CSS
Css Founder.com | Cssfounder in
Html Expression Web
CSS Basics
Ad

Viewers also liked (20)

PPT
HTML
PDF
Kwan US Trade in Services
PPT
WEB 2.0
PPT
PHP
PPT
Nuestro homenaje a
PPTX
Japan Institute for Design Promotion, December 21st, 2011, Tokyo, Japan.
PPT
MYSQL
PPTX
School magazine evaluation
PPTX
WEBD 162: What is a Web Page?
PPTX
Steps for CSS Layout
PDF
HTML&CSS 6 - Advanced CSS
PPTX
WEBD 162: display property, Float and Clear
PPT
CSS Introduction
PPTX
CSS Layout
PPT
Getting Started with your Website
PPT
Structure Web Content
PPTX
Floating
PPT
Getting Started with CSS
PPT
Laying Out Elements with CSS
PPTX
Css floats
HTML
Kwan US Trade in Services
WEB 2.0
PHP
Nuestro homenaje a
Japan Institute for Design Promotion, December 21st, 2011, Tokyo, Japan.
MYSQL
School magazine evaluation
WEBD 162: What is a Web Page?
Steps for CSS Layout
HTML&CSS 6 - Advanced CSS
WEBD 162: display property, Float and Clear
CSS Introduction
CSS Layout
Getting Started with your Website
Structure Web Content
Floating
Getting Started with CSS
Laying Out Elements with CSS
Css floats
Ad

Similar to CSS (20)

PPT
PPTX
css3.0.( Cascading Style Sheets ) pptx
PPTX
Web - CSS 1.pptx
PPT
PPTX
session2 cascading style sheet course.pptx
PPTX
session2 css cascade style sheet course.pptx
PPTX
session2_cascading_style_sheet_cssc.pptx
PPT
Basic css
PPT
Basics Of Css And Some Common Mistakes
PPTX
HTML-CSS-QUARTER4 COMPUTER PROGRAMMING SSC
PPTX
Cordova training - Day 2 Introduction to CSS 3
PPT
CSS - Basics
PPTX
PPTX
Web Programming-css.pptx
PPTX
CSS Topic wise Short notes ppt by Navya.E
PDF
Web Design Course: CSS lecture 3
DOCX
Css Introduction
css3.0.( Cascading Style Sheets ) pptx
Web - CSS 1.pptx
session2 cascading style sheet course.pptx
session2 css cascade style sheet course.pptx
session2_cascading_style_sheet_cssc.pptx
Basic css
Basics Of Css And Some Common Mistakes
HTML-CSS-QUARTER4 COMPUTER PROGRAMMING SSC
Cordova training - Day 2 Introduction to CSS 3
CSS - Basics
Web Programming-css.pptx
CSS Topic wise Short notes ppt by Navya.E
Web Design Course: CSS lecture 3
Css Introduction

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
A Presentation on Artificial Intelligence
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
KodekX | Application Modernization Development
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Per capita expenditure prediction using model stacking based on satellite ima...
A Presentation on Artificial Intelligence
Understanding_Digital_Forensics_Presentation.pptx
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
The AUB Centre for AI in Media Proposal.docx
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KodekX | Application Modernization Development
Building Integrated photovoltaic BIPV_UPV.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Empathic Computing: Creating Shared Understanding
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

CSS

  • 1. CSS Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics (that is, the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including SVG and XUL.
  • 2. HISTORY Style sheets have existed in one form or another since the beginnings of SGML in the 1970s. Cascading Style Sheets were developed as a means for creating a consistent approach to providing style information for web documents. As HTML grew, it came to encompass a wider variety of stylistic capabilities to meet the demands of web developers. This evolution gave the designer more control over site appearance but at the cost of HTML becoming more complex to write and maintain. Variations in web browser implementations made consistent site appearance difficult, and users had less control over how web content was displayed.
  • 4. STYLING BACKGROUNDS CSS properties used for background effects: CSS background properties are used to define the background effects of an element. background-color background-image background-repeat background-attachment background-position Background Color The background-color property specifies the background color of an element.The background color of a page is defined in the body selector: Example: body {background-color:#b0c4de;}
  • 5. STYLING TEXT Text Color The color property is used to set the color of the text. The color can be specified by: name - a color name, like &quot;red&quot; RGB - an RGB value, like &quot;rgb(255,0,0)&quot; Hex - a hex value, like &quot;#ff0000&quot; The default color for a page is defined in the body selector. Example body {color:blue;} h1 {color:#00ff00;} h2 {color:rgb(255,0,0);}
  • 6. CSS FONT FAMILIES CSS Font Families In CSS, there are two types of font family names: generic family - a group of font families with a similar look (like &quot;Serif&quot; or &quot;Monospace&quot;) font family - a specific font family (like &quot;Times New Roman&quot; or &quot;Arial&quot;) Font Style The font-style property is mostly used to specify italic text. This property has three values: normal - The text is shown normally italic - The text is shown in italics oblique - The text is &quot;leaning&quot; (oblique is very similar to italic, but less supported)
  • 8. BOX MODEL The CSS Box Model All HTML elements can be considered as boxes. In CSS, the term &quot;box model&quot; is used when talking about design and layout. The CSS box model is essentially a box that wraps around HTML elements, and it consists of: margins, borders, padding, and the actual content. The box model allows us to place a border around elements and space elements in relation to other elements. The image below illustrates the box model:
  • 9. BORDER Border Width The border-width property is used to set the width of the border. The width is set in pixels, or by using one of the three pre-defined values: thin, medium, or thick. Border Color The border-color property is used to set the color of the border. The color can be set by: name - specify a color name, like &quot;red&quot; RGB - specify a RGB value, like &quot;rgb(255,0,0)&quot; Hex - specify a hex value, like &quot;#ff0000&quot;
  • 10. CSS MARGIN The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent.The top, right, bottom, and left margin can be changed independently using separate properties. A shorthand margin property can also be used, to change all margins at once. Possible Values:
  • 11. CSS PADDING The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.The top, right, bottom, and left padding can be changed independently using separate properties. A shorthand padding property can also be used, to change all paddings at once. Possible Values:
  • 12. PADDING INDIVIDUAL SLIDES Padding - Individual sides In CSS, it is possible to specify different padding for different sides:
  • 13. PADDING SHORT HAND PROPERTY To shorten the code, it is possible to specify all the padding properties in one property. This is called a shorthand property.The shorthand property for all the padding properties is &quot;padding&quot;: Example: padding:25px 50px; The padding property can have from one to four values. padding:25px 50px 75px 100px; top padding is 25px right padding is 50px bottom padding is 75px left padding is 100px
  • 14. CSS GROUPING AND NESTING SELECTORS
  • 15. GROUPING SELECTORS Grouping Selectors In style sheets there are often elements with the same style. To minimize the code, you can group selectors. Separate each selector with a comma. In the example below we have grouped the selectors from the code above:
  • 16. NESTING SELECTORS Nesting Selectors It is possible to apply a style for a selector within a selector. In the example below, one style is specified for all p elements, and a separate style is specified for p elements nested within the &quot;marked&quot; class:
  • 18. CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line break before and after it. Examples of block elements: <h1> <p> <div> An inline element only takes up as much width as necessary, and does not force line breaks. Examples of inline elements: <span> <a>
  • 20. Positioning The CSS positioning properties allow you to position an element. It can also place an element behind another, and specify what should happen when an element's content is too big. Elements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the positioning method.
  • 21. Static Positioning HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page. Static positioned elements are not affected by the top, bottom, left, and right properties.
  • 22. Fixed Positioning An element with fixed position is positioned relative to the browser window. It will not move even if the window is scrolled:
  • 24. Vertical Navigation Bar To build a vertical navigation bar we only need to style the <a> elements, in addition to the code above:
  • 25. Horizontal Navigation Bar Horizontal Navigation Bar There are two ways to create a horizontal navigation bar. Using inline or floating list items. Both methods work fine, but if you want the links to be the same size, you have to use the floating method.
  • 26. CSS MEDIA TYPES Media Types allow you to specify how documents will be presented in different media. The document can be displayed differently on the screen, on the paper, with an aural browser, etc. Different Media Types: all Used for all media type devices aural Used for speech and sound synthesizers braille Used for braille tactile feedback devices embossed Used for paged braille printers handheld Used for small or handheld devices print Used for printers projection Used for projected presentations, like slides screen Used for computer screens tty Used for media using a fixed-pitch character grid, like teletypes and terminals tv Used for television-type devices
  • 27. CSS FLOAT An element can be pushed to the left or right, allowing other elements to wrap around it.Float is very often used for images, but it is also useful when working with layouts.
  • 28. Turning off Float - Using Clear Elements after the floating element will flow around it. To avoid this, use the clear property. The clear property specifies which sides of an element other floating elements are not allowed. EXAMPLE: .text_line { clear:both; }
  • 29. HOW ELEMENTS FLOAT Elements are floated horizontally, this means that an element can only be floated left or right, not up or down.A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element.The elements after the floating element will flow around it.The elements before the floating element will not be affected.
  • 30. CSS FLOAT PROPERTIES Property Description Values CSS clear Specifies which sides of an element where other floating elements are not allowed left right both none inherit 1 float Specifies whether or not a box should float left right none inherit 1