SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
Starting with CSS
What You Should Already Know
Before you continue you should have a basic understanding of the
following:
HTML / XHTML

What is CSS?
•CSS stands for Cascading Style Sheets
•Styles define how to display HTML elements
•Styles were added to HTML 4.0.
•External Style Sheets can save a lot of work
•External Style Sheets are stored in CSS files


 What the benefit of CSS?
Contents of Style Sheet
• A style sheet consists of a set of rules.
• Each rule consists of one or more selectors and a
  declaration block.
• A declaration block consists of a list of declarations in
  curly braces ({}).
• Each declaration consists of a property, a colon (:), a
  value, then a semi-colon (;).
Three Different Scopes of CSS
• Local
   – confined to a single element (tag)
• Internal
   – affect elements in an entire page
• External
   – can affect multiple pages
• Precedence
   – Local > Internal > External
CSS Selector
The id Selector                        The class Selector

•The id selector is used to            •The class selector is used to
specify a style for a single,          specify a style for a group of
unique element.                        elements. Unlike the id selector,
•The id selector uses the id           the class selector is most often
attribute of the HTML                  used on several elements.
element, and is defined with a         •This allows you to set a particular
"#".                                   style for many HTML elements with
                                       the same class.
                                       •The class selector uses the HTML
                                       class attribute, and is defined with
                                       a "."
Demo on a real HTML file in browser.
Background
Property           Description
                   Sets all the background properties in one
background
                   declaration
background-        Sets whether a background image is fixed or
attachment         scrolls with the rest of the page
background-color   Sets the background color of an element

background-image Sets the background image for an element

background-        Sets the starting position of a background
position           image

background-repeat Sets how a background image will be repeated
Text
Property        Description
color           Sets the color of text
text-align      Specifies the horizontal alignment of text

text-
                Specifies the decoration added to text
decoration

text-transform Controls the capitalization of text
Font
CSS font properties define the font family, boldness, size, and the style
of a text.
             Difference Between Serif and Sans-serif Fonts




 Generic family       Font family     Description
                      Times New
                                      Serif fonts have small lines at the
 Serif                Roman
                                      ends on some characters
                      Georgia
                                      "Sans" means without - these
                      Arial
 Sans-serif                           fonts do not have the lines at the
                      Verdana
                                      ends of characters
All CSS Font Properties
Property       Description

font           Sets all the font properties in one declaration

font-family    Specifies the font family for text

font-size      Specifies the font size of text

font-style     Specifies the font style for text

               Specifies whether or not a text should be
font-variant
               displayed in a small-caps font

font-weight    Specifies the weight of a font
Links & Lists
 The four links states are:
 a:link - a normal, unvisited link
 a:visited - a link the user has visited
 a:hover - a link when the user mouses over it
 a:active - a link the moment it is clicked

  List :In HTML, there are two types of lists:
  •unordered lists - the list items are marked with bullets
  •ordered lists - the list items are marked with numbers or letters
   The CSS list properties allow you to:
   •Set different list item markers for ordered lists
   •Set different list item markers for unordered lists
   •Set an image as the list item marker
Demo on a real HTML file in browser.
The CSS Box Model




Margin - Clears an area around the border. The margin does not have
a background color, it is completely transparent
Border - A border that goes around the padding and content. The
border is affected by the background color of the box
Padding - Clears an area around the content. The padding is affected
by the background color of the box
Content - The content of the box, where text and images appear
CSS Grouping & Nesting Selectors
     h1             p
     {              {
     color:green;
     }
                    color:blue;
     h2             text-align:center;
     {              }
     color:green;   .marked
     }              {
     p
     {
                    background-
     color:green;   color:red;
     }              }
                    .marked p
     h1,h2,p        {
     {              color:white;
     color:green;   }
     }
CSS Display and Visibility

The display property specifies if/how an element is displayed, and
the visibility property specifies if an element should be visible or
hidden.

Hiding an element can be done by setting the display property to
"none" or the visibility property to "hidden".

visibility:hidden hides an element, but it will still take up the same
space as before. The element will be hidden, but still affect the
layout.
display:none hides an element, and it will not take up any
space. The element will be hidden, and the page will be
displayed as if the element is not there
CSS Positioning
Name               Description
Static             HTML elements are positioned static by default. A
                   static positioned element is always positioned
                   according to the normal flow of the page.
Relative           A relative positioned element is positioned relative
                   to its normal position.
Absolute           An absolute position element is positioned relative
                   to the first parent element that has a position other
                   than static. If no such element is found, the
                   containing block is <html>
Fixed              An element with fixed position is positioned relative
                   to the browser window.
                   It will not move even if the window is scrolled.
Demo on a real HTML file in browser.
Stepping into CSS3
    Important Features:

    CSS3 Borders
    CSS3 Backgrounds
    CSS3 Text Effects
    CSS3 2D Transforms
    CSS3 3D Transforms
    CSS3 Transitions
    CSS3 Animations
    CSS3 Multiple Columns



Demo on a real HTML file in browser.
Some Demos in Practical




Reference : This presentation slide contains
the contents links from W3SCHOOL.
Link: http://www.w3schools.com/

Contenu connexe

Tendances

1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 

Tendances (20)

Responsive web design with html5 and css3
Responsive web design with html5 and css3Responsive web design with html5 and css3
Responsive web design with html5 and css3
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Html
HtmlHtml
Html
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Css ppt
Css pptCss ppt
Css ppt
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Html css
Html cssHtml css
Html css
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
 
4. Web Technology CSS Basics-1
4. Web Technology CSS Basics-14. Web Technology CSS Basics-1
4. Web Technology CSS Basics-1
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Css
CssCss
Css
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 

Similaire à Introduction 2 css

Similaire à Introduction 2 css (20)

Css
CssCss
Css
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
 
Css
CssCss
Css
 
Css jon duckett - flashcards
Css   jon duckett - flashcardsCss   jon duckett - flashcards
Css jon duckett - flashcards
 
Basic css-tutorial
Basic css-tutorialBasic css-tutorial
Basic css-tutorial
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
CSS.pptx
CSS.pptxCSS.pptx
CSS.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
Css from scratch
Css from scratchCss from scratch
Css from scratch
 
Journey To The Front End World - Part2 - The Cosmetic
Journey To The Front End World - Part2 - The  CosmeticJourney To The Front End World - Part2 - The  Cosmetic
Journey To The Front End World - Part2 - The Cosmetic
 
CSS
CSSCSS
CSS
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
css3.pptx
css3.pptxcss3.pptx
css3.pptx
 
Web technology
Web technologyWeb technology
Web technology
 
CSS Presentation Notes.pptx
CSS Presentation Notes.pptxCSS Presentation Notes.pptx
CSS Presentation Notes.pptx
 
Css Founder.com | Cssfounder in
Css Founder.com | Cssfounder inCss Founder.com | Cssfounder in
Css Founder.com | Cssfounder in
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Introduction 2 css

  • 1. Starting with CSS What You Should Already Know Before you continue you should have a basic understanding of the following: HTML / XHTML What is CSS? •CSS stands for Cascading Style Sheets •Styles define how to display HTML elements •Styles were added to HTML 4.0. •External Style Sheets can save a lot of work •External Style Sheets are stored in CSS files What the benefit of CSS?
  • 2. Contents of Style Sheet • A style sheet consists of a set of rules. • Each rule consists of one or more selectors and a declaration block. • A declaration block consists of a list of declarations in curly braces ({}). • Each declaration consists of a property, a colon (:), a value, then a semi-colon (;).
  • 3. Three Different Scopes of CSS • Local – confined to a single element (tag) • Internal – affect elements in an entire page • External – can affect multiple pages • Precedence – Local > Internal > External
  • 4. CSS Selector The id Selector The class Selector •The id selector is used to •The class selector is used to specify a style for a single, specify a style for a group of unique element. elements. Unlike the id selector, •The id selector uses the id the class selector is most often attribute of the HTML used on several elements. element, and is defined with a •This allows you to set a particular "#". style for many HTML elements with the same class. •The class selector uses the HTML class attribute, and is defined with a "." Demo on a real HTML file in browser.
  • 5. Background Property Description Sets all the background properties in one background declaration background- Sets whether a background image is fixed or attachment scrolls with the rest of the page background-color Sets the background color of an element background-image Sets the background image for an element background- Sets the starting position of a background position image background-repeat Sets how a background image will be repeated
  • 6. Text Property Description color Sets the color of text text-align Specifies the horizontal alignment of text text- Specifies the decoration added to text decoration text-transform Controls the capitalization of text
  • 7. Font CSS font properties define the font family, boldness, size, and the style of a text. Difference Between Serif and Sans-serif Fonts Generic family Font family Description Times New Serif fonts have small lines at the Serif Roman ends on some characters Georgia "Sans" means without - these Arial Sans-serif fonts do not have the lines at the Verdana ends of characters
  • 8. All CSS Font Properties Property Description font Sets all the font properties in one declaration font-family Specifies the font family for text font-size Specifies the font size of text font-style Specifies the font style for text Specifies whether or not a text should be font-variant displayed in a small-caps font font-weight Specifies the weight of a font
  • 9. Links & Lists The four links states are: a:link - a normal, unvisited link a:visited - a link the user has visited a:hover - a link when the user mouses over it a:active - a link the moment it is clicked List :In HTML, there are two types of lists: •unordered lists - the list items are marked with bullets •ordered lists - the list items are marked with numbers or letters The CSS list properties allow you to: •Set different list item markers for ordered lists •Set different list item markers for unordered lists •Set an image as the list item marker Demo on a real HTML file in browser.
  • 10. The CSS Box Model Margin - Clears an area around the border. The margin does not have a background color, it is completely transparent Border - A border that goes around the padding and content. The border is affected by the background color of the box Padding - Clears an area around the content. The padding is affected by the background color of the box Content - The content of the box, where text and images appear
  • 11. CSS Grouping & Nesting Selectors h1 p { { color:green; } color:blue; h2 text-align:center; { } color:green; .marked } { p { background- color:green; color:red; } } .marked p h1,h2,p { { color:white; color:green; } }
  • 12. CSS Display and Visibility The display property specifies if/how an element is displayed, and the visibility property specifies if an element should be visible or hidden. Hiding an element can be done by setting the display property to "none" or the visibility property to "hidden". visibility:hidden hides an element, but it will still take up the same space as before. The element will be hidden, but still affect the layout. display:none hides an element, and it will not take up any space. The element will be hidden, and the page will be displayed as if the element is not there
  • 13. CSS Positioning Name Description Static HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page. Relative A relative positioned element is positioned relative to its normal position. Absolute An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is <html> Fixed An element with fixed position is positioned relative to the browser window. It will not move even if the window is scrolled. Demo on a real HTML file in browser.
  • 14. Stepping into CSS3 Important Features: CSS3 Borders CSS3 Backgrounds CSS3 Text Effects CSS3 2D Transforms CSS3 3D Transforms CSS3 Transitions CSS3 Animations CSS3 Multiple Columns Demo on a real HTML file in browser.
  • 15. Some Demos in Practical Reference : This presentation slide contains the contents links from W3SCHOOL. Link: http://www.w3schools.com/