SlideShare a Scribd company logo
1 of 29
INTRODUCTION TO CSS3
SESSION 5
Aptech Computer Education
Presented by Muhammad Ehtisham Siddiqui (BSCS)
1
Objectives
 Identify the new functions of CSS3
 Explain the different types of selectors
 Explain nested tags
 Define Classes and IDs for applying styles
 Explain the process to apply styles to hyperlink
Presented by Muhammad Ehtisham Siddiqui (BSCS)
2
Introduction of CSS
Presented by Muhammad Ehtisham Siddiqui
(BSCS)
3
 Cascading Style Sheet (CSS) is a style sheet language
 It informs the browser how to present a document
 It uses a markup language for describing the presentation
semantics of a document.
 It defines how HTML elements are to be displayed
CSS3
Presented by Muhammad Ehtisham Siddiqui
(BSCS)
4
 Used for adding style such as fonts, colors, and spacing to Web
documents.
 Has multiple levels and profiles.
 Updates each level of CSS from the earlier version, by adding new
features
 Denotes version as CSS1, CSS2, CSS3, and CSS4, where the
numbers are different for each version or level.
 Is divided into multiple documents called “modules” and each of
these modules have new capabilities or extends the features
present in CSS2.
 Started drafting of CSS3 when publication of the original CSS2
recommendation was released.
Modules
Presented by Muhammad Ehtisham Siddiqui (BSCS)
5
 As CSS3 is available as modules and is still evolving, there
are many modules having different stability and status.
 Only three modules are released as recommendations and
they are as follows:
 CSS Color level 3
 CSS Namespaces
 Selectors Level 3
 Modules that are stable and in recommendation stage are as
follows:
 Media Queries
 CSS Style Attributes
Modules
Presented by Muhammad Ehtisham Siddiqui (BSCS)
6
 Modules that are in testing phase and in recommendation stage are
as follows:
 CSS Background and Borders Level 3
 CSS Image Values and Replaced Content Level 3
 CSS Marquee
 CSS Multi-column Layout
 CSS Speech
 CSS Mobile Profile 2.0
 CSS TV Profile 1.0
 Modules that are in refining phase and in working draft stage are as
follows:
 CSS Transforms
 CSS Transitions
 CSS Values and Units Level 3
 CSS Print Profile
Modules
Presented by Muhammad Ehtisham Siddiqui (BSCS)
7
 Modules that are in revising phase and in working draft and
recommendation stage are as follows:
 CSS Animations
 CSS Flexible Box Layout
 CSS Fonts Level 3
 CSS Text Level 3
 CSS Basic User Interface Level 3
 CSS Writing Modes Level 3
 Some of the following modules are in exploring phase and in
working draft stage:
 CSS Cascading and Inheritance Level 3
 CSS Conditional Rules Level 3
 CSS Grid Layout
 CSS Line Grid
Modules
Presented by Muhammad Ehtisham Siddiqui (BSCS)
8
 Modules that are in rewriting phase and in working draft stage are
as follows:
 CSS Line Layout Level 3
 CSS Ruby
 CSS Syntax Level 3
 Modules that are in abandoned phase and in working draft stage
are as follows:
 Behavioral Extensions to CSS
 CSS Hyperlink Presentation
CSS Syntax
Presented by Muhammad Ehtisham Siddiqui (BSCS)
9
 Syntax of CSS consists of three parts namely, selector, property,
and value.
 Selector is an HTML element for which you want to specify the style
or the formatting instruction.
 Property of a selected element is a CSS property that specifies the
type of the style to be applied to the selector.
 Value refers to the value of the CSS property and a CSS property
can have multiple values.
 Property and the value for a selector are separated with a colon (:).
 They are enclosed within the curly brackets ({}) that is known as the
declaration block.
CSS Syntax
Presented by Muhammad Ehtisham Siddiqui (BSCS)
10
 You can specify multiple property-value pairs for a selector, which
are separated by a semicolon (;) within the declaration block..
 You can specify multiple selectors for a single property by grouping
the selectors. To group the selectors, the selectors are separated by
commas followed by a declaration block of properties and values.
 You can specify properties for multiple selectors. Here, the comma-
separated selectors are followed with multiple property-value pairs
Length Measurement Units
Presented by Muhammad Ehtisham Siddiqui (BSCS)
11
 CSS uses various units of measurements for specifying size of the
font, width, and height of margins, and so on.
 These units measure the horizontal and vertical length of the content.
 CSS supports two types of length measurement units namely, relative
and absolute.
 Relative length specifies the length units related to other length
property that are calculated in comparison to a current value.
 Following table lists some of the relative length units.
Relative
Length
Description
em Specifies the font size (height) of a particular font. The em unit is
relative to the value of the font-size property of the selector
ex Specifies the ‘x-height’ of a particular font. The ‘x-height’ value is
approximately half the font size or the height of the lowercase letter
‘x
px Specifies the size in pixels, which is relative to the screen of the
Length Measurement Units
Presented by Muhammad Ehtisham Siddiqui (BSCS)
12
 Absolute lengths are specified when the Web page designer is aware
of the physical properties of the output device and are specific and
fixed values
 Following table lists some of the absolute length units
 Percentage allows specifying the length of the content, which is
relative to another value. Div1{
font-size:120%
}
Relative
Length
Description
in Specifies the size in inches, where 1 inch = 2.54 centimeters.
cm Specifies the size in centimeters
mm Specifies the size in millimeters
pt Specifies the size in points, where 1 point = 1/72th of an inch
pc Specifies the size in picas, where 1 pica = 12 points
Types of Style Sheets
Presented by Muhammad Ehtisham Siddiqui (BSCS)
13
External Style Sheet
Presented by Muhammad Ehtisham Siddiqui (BSCS)
14
 With an external style sheet, you can change the look of an entire
website by changing just one file!
 Each page must include a reference to the external style sheet file
inside the <link> element. The <link> element goes inside the
<head> section:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
body {
background-
color: lightblue;
}
h1 {
color: navy;
margin-
left: 20px;
}
Internal Style Sheet
Presented by Muhammad Ehtisham Siddiqui (BSCS)
15
 An internal style sheet may be used if one single page has a unique
style.
 Internal styles are defined within the <style> element, inside the
<head> section of an HTML page:
 <!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head><body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
Inline Styles
Presented by Muhammad Ehtisham Siddiqui (BSCS)
16
 An inline style may be used to apply a unique style for a single
element.
 To use inline styles, add the style attribute to the relevant element.
The style attribute can contain any CSS property.
 The example below shows how to change the color and the left
margin of a <h1> element:
 <!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 style="color:blue;margin-left:30px;">This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Selectors
Presented by Muhammad Ehtisham Siddiqui (BSCS)
17
 Selectors refer to the HTML elements with the styles that the users
want to apply to them.
 The four different types of CSS selectors are as follows:
 Universal selectors
 Type selectors
 ID selectors
 Class selectors
Type Selector
Presented by Muhammad Ehtisham Siddiqui (BSCS)
18
 Specifies the element name along with the styles to be applied to
that element
 Results in application of the specified styles to all the occurrence of
that element in a Web page
 Styles are specified only once for an HTML element and are applied
to all the occurrences of that elements
Syntax= element {
style properties
}
 For example= a{ h1{
color:red; background-color:blue
} }
Class Selector
Presented by Muhammad Ehtisham Siddiqui (BSCS)
19
 The .class selector selects elements with a specific class attribute.
 To select elements with a specific class, write a period (.) character,
followed by the name of the class.
 HTML elements can also refer to more than one class (look at
Example 2 below).
 Syntax= .class {
css declarations;
}
For example=
.hometown {
background-color: yellow;
}
<p class=“hometown” />
Id Selector
Presented by Muhammad Ehtisham Siddiqui (BSCS)
20
 The * selector selects all elements.
 The * selector can also select all elements inside another element
(See "More Examples").
 To reference an ID, you precede the ID name with a hash mark (#).
 Syntax= #id {
CSS Declaration
}
For example=
Universal Selector
Presented by Muhammad Ehtisham Siddiqui (BSCS)
21
 The universal selector denoted by *.
 The * selector selects all elements.
 The * selector can also select all elements inside another element
(See "More Examples").
 To reference an ID, you precede the ID name with a hash mark (#).
 Syntax= * {
CSS Declaration
}
For example=
div * {
background-color: yellow;
}
Generic Cascading Order
Presented by Muhammad Ehtisham Siddiqui (BSCS)
22
 W3C has defied some rules for applying styles to an HTML element.
 These rules are as follows.
 Gather all the styles that are to be applied to an element.
 Sort the declarations by the source and type of style sheet. The
source specifies the origin from where the styles are rendered.
 The highest priority is given to the external style sheet defied by an
author.
 The next priority is of the reader, which can be a software that reads the
content (screen reader software),and the last priority is of the browser.
Comments
Presented by Muhammad Ehtisham Siddiqui (BSCS)
23
 A comment refers to the descriptive text that allows a Web page
designer to provide information about the CSS code.
 Comments make the program more readable and help
the designer to explain the styles specified for elements.
 The browser can identity comments as they are marked with special
characters, which are
‘/*’ and ‘*/’.
 When the browser encounters these symbols, the text within them
are ignored
and are not displayed in the browser.
 You can have single-line and multi-line comments in
the CSS fie.
Pseudo Classes
Presented by Muhammad Ehtisham Siddiqui (BSCS)
24
 A pseudo-class is used to define a special state of an element.
 For example, it can be used to:
 Style an element when a user mouse over it
 Style visited and unvisited links differently
 Style an element when it gets focus
 The syntax of pseudo-classes:
selector: pseudo-class
{
property: value;
}
Pseudo Classes
Presented by Muhammad Ehtisham Siddiqui (BSCS)
25
 Try this code
<!DOCTYPE html><html>
<head><style>
/* unvisited link */
a:link { color: red;}
/* visited link */
a:visited { color: green;}
/* mouse over link */
a:hover { color: hotpink;}
/* selected link */
a:active { color: blue;}
</style></head>
<body>
<p><b><a href="default.asp" target="_blank">This is a link</a></b></p>
<p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition
in order to be effective.</p>
<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to
be effective.</p>
</body></html>
Pseudo Class Selectors
Presented by Muhammad Ehtisham Siddiqui (BSCS)
26
Selector Type Description
:link Links Is used for selecting all unvisited links
:visited Links Is used for selecting all visited links
:hover Links Is used for selecting links on mouse over
:active Links Is used for selecting the active link
:focus Inputs Selects links that are the current focus of the
keyboard.
:enabled Inputs Selects inputs that are in the default state of
enabled and ready to be used.
:disabled Inputs Selects inputs that have the disabled attribute.
:required Inputs Selects inputs with the required attribute.
:checked Inputs Selects checkboxes that are, wait for it, checked.
:read-
only / :read-write
Inputs Selects elements based on a combination
of readonly and disabled attriutes.
Pseudo Class Selectors
Presented by Muhammad Ehtisham Siddiqui (BSCS)
27
Selector Type Description
:root Position
based
Selects the element that is at the root of the
document.
:first-child Position
based
Selects the first element within a parent.
:last-child Position
based
Selects the last element within a parent.
:nth-child() Position
based
Selects elements based on a simple provided
algebraic expression (e.g. "2n" or "4n-1").
:empty Relational Selects elements which contain no text and no
child elements. Like: <p></p>
::first-letter Text Related Selects the first letter of the text in the element.
::first-line Text Related Selects the first line of text in the element.
::before Content
Related
Is able to add content before a certain element.
Styles to Hyperlinks
Presented by Muhammad Ehtisham Siddiqui (BSCS)
28
 CSS can be used to change the appearance and behavior of
hyperlinks
 There are two other ways to assign hyperlink styles namely, div specific
and Link specific.
 A div specific hyperlink styles can be created and assigned to a specific
div and will have all the hyperlinks present within the div to follow the
specified rules
 Class specific hyperlink styles generally uses a class than an id. A point
to note that an id can only be used once on a page whereas a class
can be used multiple times as required
 For Example:
 a {
color: hotpink;
}
Questions?
Presented by Muhammad Ehtisham Siddiqui (BSCS)
29

More Related Content

Similar to Building Next Generation Websites by Muhammad Ehtisham Siddiqui

Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...JebaRaj26
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2Shawn Calvert
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsQA TrainingHub
 
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.pptxJJFajardo1
 
New Css style
New Css styleNew Css style
New Css styleBUDNET
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting LabSwapnali Pawar
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.pptdatapro2
 
3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.pptmohamed abd elrazek
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.pptscet315
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designersSingsys Pte Ltd
 
Css Founder.com | Cssfounder Company
Css Founder.com | Cssfounder CompanyCss Founder.com | Cssfounder Company
Css Founder.com | Cssfounder CompanyCss Founder
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)Rafi Haidari
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSSHemant Patidar
 

Similar to Building Next Generation Websites by Muhammad Ehtisham Siddiqui (20)

Css
CssCss
Css
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
 
CSS.pptx
CSS.pptxCSS.pptx
CSS.pptx
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentials
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
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.html
Css.htmlCss.html
Css.html
 
New Css style
New Css styleNew Css style
New Css style
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
 
3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Css Founder.com | Cssfounder Company
Css Founder.com | Cssfounder CompanyCss Founder.com | Cssfounder Company
Css Founder.com | Cssfounder Company
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
 
Css
CssCss
Css
 
Css
CssCss
Css
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSS
 

More from Muhammad Ehtisham Siddiqui

J Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiJ Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiMuhammad Ehtisham Siddiqui
 
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham SiddiquiBuiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham SiddiquiMuhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation  Websites Session 7 by Muhammad Ehtisham SiddiquiBuilding Next Generation  Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 7 by Muhammad Ehtisham SiddiquiMuhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham SiddiquiMuhammad Ehtisham Siddiqui
 

More from Muhammad Ehtisham Siddiqui (20)

C programming Tutorial Session 4
C programming Tutorial Session 4C programming Tutorial Session 4
C programming Tutorial Session 4
 
C programming Tutorial Session 4
C programming Tutorial Session 4C programming Tutorial Session 4
C programming Tutorial Session 4
 
C programming Tutorial Session 3
C programming Tutorial Session 3C programming Tutorial Session 3
C programming Tutorial Session 3
 
C programming Tutorial Session 2
C programming Tutorial Session 2C programming Tutorial Session 2
C programming Tutorial Session 2
 
C programming Tutorial Session 1
C programming Tutorial Session 1C programming Tutorial Session 1
C programming Tutorial Session 1
 
HTML5 Web storage
HTML5 Web storageHTML5 Web storage
HTML5 Web storage
 
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiJ Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
 
JavaScript Session 2
JavaScript Session 2JavaScript Session 2
JavaScript Session 2
 
JavaScript Session 3
JavaScript Session 3JavaScript Session 3
JavaScript Session 3
 
Javascript session 1
Javascript session 1Javascript session 1
Javascript session 1
 
Html audio video
Html audio videoHtml audio video
Html audio video
 
Html 5 geolocation api
Html 5 geolocation api Html 5 geolocation api
Html 5 geolocation api
 
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham SiddiquiBuiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
Buiding Next Generation Websites Session 8 by Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation  Websites Session 7 by Muhammad Ehtisham SiddiquiBuilding Next Generation  Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 6 by Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites Session6
Building Next Generation Websites Session6Building Next Generation Websites Session6
Building Next Generation Websites Session6
 
Building Next Generation Websites Session5
Building Next Generation Websites Session5Building Next Generation Websites Session5
Building Next Generation Websites Session5
 
Building Next Generation Websites Session4
Building Next Generation Websites Session4Building Next Generation Websites Session4
Building Next Generation Websites Session4
 
Session4
Session4Session4
Session4
 
Office session14
Office session14Office session14
Office session14
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

Building Next Generation Websites by Muhammad Ehtisham Siddiqui

  • 1. INTRODUCTION TO CSS3 SESSION 5 Aptech Computer Education Presented by Muhammad Ehtisham Siddiqui (BSCS) 1
  • 2. Objectives  Identify the new functions of CSS3  Explain the different types of selectors  Explain nested tags  Define Classes and IDs for applying styles  Explain the process to apply styles to hyperlink Presented by Muhammad Ehtisham Siddiqui (BSCS) 2
  • 3. Introduction of CSS Presented by Muhammad Ehtisham Siddiqui (BSCS) 3  Cascading Style Sheet (CSS) is a style sheet language  It informs the browser how to present a document  It uses a markup language for describing the presentation semantics of a document.  It defines how HTML elements are to be displayed
  • 4. CSS3 Presented by Muhammad Ehtisham Siddiqui (BSCS) 4  Used for adding style such as fonts, colors, and spacing to Web documents.  Has multiple levels and profiles.  Updates each level of CSS from the earlier version, by adding new features  Denotes version as CSS1, CSS2, CSS3, and CSS4, where the numbers are different for each version or level.  Is divided into multiple documents called “modules” and each of these modules have new capabilities or extends the features present in CSS2.  Started drafting of CSS3 when publication of the original CSS2 recommendation was released.
  • 5. Modules Presented by Muhammad Ehtisham Siddiqui (BSCS) 5  As CSS3 is available as modules and is still evolving, there are many modules having different stability and status.  Only three modules are released as recommendations and they are as follows:  CSS Color level 3  CSS Namespaces  Selectors Level 3  Modules that are stable and in recommendation stage are as follows:  Media Queries  CSS Style Attributes
  • 6. Modules Presented by Muhammad Ehtisham Siddiqui (BSCS) 6  Modules that are in testing phase and in recommendation stage are as follows:  CSS Background and Borders Level 3  CSS Image Values and Replaced Content Level 3  CSS Marquee  CSS Multi-column Layout  CSS Speech  CSS Mobile Profile 2.0  CSS TV Profile 1.0  Modules that are in refining phase and in working draft stage are as follows:  CSS Transforms  CSS Transitions  CSS Values and Units Level 3  CSS Print Profile
  • 7. Modules Presented by Muhammad Ehtisham Siddiqui (BSCS) 7  Modules that are in revising phase and in working draft and recommendation stage are as follows:  CSS Animations  CSS Flexible Box Layout  CSS Fonts Level 3  CSS Text Level 3  CSS Basic User Interface Level 3  CSS Writing Modes Level 3  Some of the following modules are in exploring phase and in working draft stage:  CSS Cascading and Inheritance Level 3  CSS Conditional Rules Level 3  CSS Grid Layout  CSS Line Grid
  • 8. Modules Presented by Muhammad Ehtisham Siddiqui (BSCS) 8  Modules that are in rewriting phase and in working draft stage are as follows:  CSS Line Layout Level 3  CSS Ruby  CSS Syntax Level 3  Modules that are in abandoned phase and in working draft stage are as follows:  Behavioral Extensions to CSS  CSS Hyperlink Presentation
  • 9. CSS Syntax Presented by Muhammad Ehtisham Siddiqui (BSCS) 9  Syntax of CSS consists of three parts namely, selector, property, and value.  Selector is an HTML element for which you want to specify the style or the formatting instruction.  Property of a selected element is a CSS property that specifies the type of the style to be applied to the selector.  Value refers to the value of the CSS property and a CSS property can have multiple values.  Property and the value for a selector are separated with a colon (:).  They are enclosed within the curly brackets ({}) that is known as the declaration block.
  • 10. CSS Syntax Presented by Muhammad Ehtisham Siddiqui (BSCS) 10  You can specify multiple property-value pairs for a selector, which are separated by a semicolon (;) within the declaration block..  You can specify multiple selectors for a single property by grouping the selectors. To group the selectors, the selectors are separated by commas followed by a declaration block of properties and values.  You can specify properties for multiple selectors. Here, the comma- separated selectors are followed with multiple property-value pairs
  • 11. Length Measurement Units Presented by Muhammad Ehtisham Siddiqui (BSCS) 11  CSS uses various units of measurements for specifying size of the font, width, and height of margins, and so on.  These units measure the horizontal and vertical length of the content.  CSS supports two types of length measurement units namely, relative and absolute.  Relative length specifies the length units related to other length property that are calculated in comparison to a current value.  Following table lists some of the relative length units. Relative Length Description em Specifies the font size (height) of a particular font. The em unit is relative to the value of the font-size property of the selector ex Specifies the ‘x-height’ of a particular font. The ‘x-height’ value is approximately half the font size or the height of the lowercase letter ‘x px Specifies the size in pixels, which is relative to the screen of the
  • 12. Length Measurement Units Presented by Muhammad Ehtisham Siddiqui (BSCS) 12  Absolute lengths are specified when the Web page designer is aware of the physical properties of the output device and are specific and fixed values  Following table lists some of the absolute length units  Percentage allows specifying the length of the content, which is relative to another value. Div1{ font-size:120% } Relative Length Description in Specifies the size in inches, where 1 inch = 2.54 centimeters. cm Specifies the size in centimeters mm Specifies the size in millimeters pt Specifies the size in points, where 1 point = 1/72th of an inch pc Specifies the size in picas, where 1 pica = 12 points
  • 13. Types of Style Sheets Presented by Muhammad Ehtisham Siddiqui (BSCS) 13
  • 14. External Style Sheet Presented by Muhammad Ehtisham Siddiqui (BSCS) 14  With an external style sheet, you can change the look of an entire website by changing just one file!  Each page must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside the <head> section: <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> body { background- color: lightblue; } h1 { color: navy; margin- left: 20px; }
  • 15. Internal Style Sheet Presented by Muhammad Ehtisham Siddiqui (BSCS) 15  An internal style sheet may be used if one single page has a unique style.  Internal styles are defined within the <style> element, inside the <head> section of an HTML page:  <!DOCTYPE html> <html> <head> <style> body { background-color: linen; } h1 { color: maroon; margin-left: 40px; } </style> </head><body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body>
  • 16. Inline Styles Presented by Muhammad Ehtisham Siddiqui (BSCS) 16  An inline style may be used to apply a unique style for a single element.  To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.  The example below shows how to change the color and the left margin of a <h1> element:  <!DOCTYPE html> <html> <head> </head> <body> <h1 style="color:blue;margin-left:30px;">This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 17. Selectors Presented by Muhammad Ehtisham Siddiqui (BSCS) 17  Selectors refer to the HTML elements with the styles that the users want to apply to them.  The four different types of CSS selectors are as follows:  Universal selectors  Type selectors  ID selectors  Class selectors
  • 18. Type Selector Presented by Muhammad Ehtisham Siddiqui (BSCS) 18  Specifies the element name along with the styles to be applied to that element  Results in application of the specified styles to all the occurrence of that element in a Web page  Styles are specified only once for an HTML element and are applied to all the occurrences of that elements Syntax= element { style properties }  For example= a{ h1{ color:red; background-color:blue } }
  • 19. Class Selector Presented by Muhammad Ehtisham Siddiqui (BSCS) 19  The .class selector selects elements with a specific class attribute.  To select elements with a specific class, write a period (.) character, followed by the name of the class.  HTML elements can also refer to more than one class (look at Example 2 below).  Syntax= .class { css declarations; } For example= .hometown { background-color: yellow; } <p class=“hometown” />
  • 20. Id Selector Presented by Muhammad Ehtisham Siddiqui (BSCS) 20  The * selector selects all elements.  The * selector can also select all elements inside another element (See "More Examples").  To reference an ID, you precede the ID name with a hash mark (#).  Syntax= #id { CSS Declaration } For example=
  • 21. Universal Selector Presented by Muhammad Ehtisham Siddiqui (BSCS) 21  The universal selector denoted by *.  The * selector selects all elements.  The * selector can also select all elements inside another element (See "More Examples").  To reference an ID, you precede the ID name with a hash mark (#).  Syntax= * { CSS Declaration } For example= div * { background-color: yellow; }
  • 22. Generic Cascading Order Presented by Muhammad Ehtisham Siddiqui (BSCS) 22  W3C has defied some rules for applying styles to an HTML element.  These rules are as follows.  Gather all the styles that are to be applied to an element.  Sort the declarations by the source and type of style sheet. The source specifies the origin from where the styles are rendered.  The highest priority is given to the external style sheet defied by an author.  The next priority is of the reader, which can be a software that reads the content (screen reader software),and the last priority is of the browser.
  • 23. Comments Presented by Muhammad Ehtisham Siddiqui (BSCS) 23  A comment refers to the descriptive text that allows a Web page designer to provide information about the CSS code.  Comments make the program more readable and help the designer to explain the styles specified for elements.  The browser can identity comments as they are marked with special characters, which are ‘/*’ and ‘*/’.  When the browser encounters these symbols, the text within them are ignored and are not displayed in the browser.  You can have single-line and multi-line comments in the CSS fie.
  • 24. Pseudo Classes Presented by Muhammad Ehtisham Siddiqui (BSCS) 24  A pseudo-class is used to define a special state of an element.  For example, it can be used to:  Style an element when a user mouse over it  Style visited and unvisited links differently  Style an element when it gets focus  The syntax of pseudo-classes: selector: pseudo-class { property: value; }
  • 25. Pseudo Classes Presented by Muhammad Ehtisham Siddiqui (BSCS) 25  Try this code <!DOCTYPE html><html> <head><style> /* unvisited link */ a:link { color: red;} /* visited link */ a:visited { color: green;} /* mouse over link */ a:hover { color: hotpink;} /* selected link */ a:active { color: blue;} </style></head> <body> <p><b><a href="default.asp" target="_blank">This is a link</a></b></p> <p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.</p> <p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be effective.</p> </body></html>
  • 26. Pseudo Class Selectors Presented by Muhammad Ehtisham Siddiqui (BSCS) 26 Selector Type Description :link Links Is used for selecting all unvisited links :visited Links Is used for selecting all visited links :hover Links Is used for selecting links on mouse over :active Links Is used for selecting the active link :focus Inputs Selects links that are the current focus of the keyboard. :enabled Inputs Selects inputs that are in the default state of enabled and ready to be used. :disabled Inputs Selects inputs that have the disabled attribute. :required Inputs Selects inputs with the required attribute. :checked Inputs Selects checkboxes that are, wait for it, checked. :read- only / :read-write Inputs Selects elements based on a combination of readonly and disabled attriutes.
  • 27. Pseudo Class Selectors Presented by Muhammad Ehtisham Siddiqui (BSCS) 27 Selector Type Description :root Position based Selects the element that is at the root of the document. :first-child Position based Selects the first element within a parent. :last-child Position based Selects the last element within a parent. :nth-child() Position based Selects elements based on a simple provided algebraic expression (e.g. "2n" or "4n-1"). :empty Relational Selects elements which contain no text and no child elements. Like: <p></p> ::first-letter Text Related Selects the first letter of the text in the element. ::first-line Text Related Selects the first line of text in the element. ::before Content Related Is able to add content before a certain element.
  • 28. Styles to Hyperlinks Presented by Muhammad Ehtisham Siddiqui (BSCS) 28  CSS can be used to change the appearance and behavior of hyperlinks  There are two other ways to assign hyperlink styles namely, div specific and Link specific.  A div specific hyperlink styles can be created and assigned to a specific div and will have all the hyperlinks present within the div to follow the specified rules  Class specific hyperlink styles generally uses a class than an id. A point to note that an id can only be used once on a page whereas a class can be used multiple times as required  For Example:  a { color: hotpink; }
  • 29. Questions? Presented by Muhammad Ehtisham Siddiqui (BSCS) 29

Editor's Notes

  1. Presentation slide for courses, classes, lectures et al.
  2. Beginning course details and/or books/materials needed for a class/project.
  3. Beginning course details and/or books/materials needed for a class/project.
  4. Beginning course details and/or books/materials needed for a class/project.
  5. Beginning course details and/or books/materials needed for a class/project.
  6. Beginning course details and/or books/materials needed for a class/project.
  7. Beginning course details and/or books/materials needed for a class/project.
  8. Beginning course details and/or books/materials needed for a class/project.
  9. Example graph/chart.