SlideShare a Scribd company logo
CSS Cascade Style Sheet
Adeel Rasheed
Custom Web Application Developer
 https://chauhantricks.blogspot.com
 https://www.fiverr.com/adeelrasheed
What is CSS?
CSS stands for Cascading Style Sheets
CSS describes how HTML elements
are to be displayed on screen
CSS saves a lot of work. It can
control the layout of multiple web
pages all at once
CSS Syntax
 A CSS comprises of style rules that are interpreted by the
browser and then applied to the corresponding elements in
your document.
 A style rule is made of three parts −
 Selector − A selector is an HTML tag at which a style will
be applied. This could be any tag like <h1> or <table> etc.
 Property - A property is a type of attribute of HTML tag.
Put simply, all the HTML attributes are converted into CSS
properties. They could be color, border etc.
 Value - Values are assigned to properties. For
example, colorproperty can have value
either red or #F1F1F1 etc.
CSS Syntax
selector { property: value }
You can put CSS Style Rule Syntax as
follows −
Example
p {
color: red;
text-align: center;
}
CSS Selectors
 Selectors are one of the most important aspects of CSS as they are used to select elements on a web
page so that they can be styled.
1-Element Type Selector
 An element type selector matches every instance of the element in the document tree with the
corresponding element type name.
Example
p {
color: blue;
}
2-Id Selectors
The id selector is used to define style rules for a single or unique element.
The id selector is defined with a '#' (hash) sign immediately followed by the id value.
Example
#error {
color: red;
}
3-Class Selector
 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.
Example
.center {
text-align: center;
color: red;
}
Inserting CSS
Three Ways to Insert CSS
 External style sheet
 Internal style sheet
 Inline style
External Style Sheet
 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:
 The style sheet file must be saved with a .css extension.
Example
 <head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Internal Style Sheet
 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:
Example
 <head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
Inline Styles
 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:
Example
 <h1 style="color:blue;margin-left:30px;">This is a
heading.</h1>
Color property
Colors in CSS are most often specified by:
 a valid color name - like "red"
 an RGB value - like "rgb(255, 0, 0)"
 a HEX value - like "#ff0000"
Background property
Element Property Initial value
'background-attachment' scroll | fixed | inherit scroll
'background-color' <color> | transparent | inherit transparent
'background-image' <url> | none | inherit none
'background-position'
[ [ <percentage> | <length> | left | center | right ]
[ <percentage> |<length> | top | center | bottom ]? ]
| [ [ left | center | right ] || [ top | center | bottom ] ]
| inherit 0% 0%
'background-repeat' repeat | repeat-x | repeat-y | no-repeat | inherit repeat
'background'
['background-color' || 'background-
image' || 'background-repeat' ||'background-
attachment' ||'background-position'] | inherit
see individual
properties
Border propertyElement Property Initial value
'border-color' [ <color> |
see individual
properties
'border-spacing' <length> <length>? 0
'border-style'
None,solid,dotted,dashed,double,groove,ridge,
inset,outset,hidden
see individual
properties
'border-top''border-right''border-
bottom''border-left'
[ <border-width> || <border-style> ||'border-top-
color' ]
see individual
properties
'border-top-color' 'border-right-
color''border-bottom-color' 'border-left-
color' <color>
the value of the
'color' property
'border-top-style' 'border-right-
style''border-bottom-style' 'border-left-
style' <border-style> None
'border-top-width' 'border-right-
width''border-bottom-width' 'border-left-
width' <border-width> medium
'border-width'
length in px, pt or cm or it should be set
to thin, medium or thick.
see individual
properties
'border' [ <border-width> || <border-style> ||'border-color' ]
see individual
properties
Round Border property
Element Property Initial value
'border-radius’ In pixels
see
individual
properties
'border-top-right-radius'‘
'border-top-left-radius‘‘
'border-botttom-right-radius'‘
'border-bottom-left-radius‘‘ In pixels
see
individual
properties
Outline Property
 An outline is a line that is drawn around elements
(outside the borders) to make the element "stand out".
 Similar to border
 Outline Sets all the outline properties in one
declaration
 outline-color Sets the color of an outline
 outline-offset Specifies the space between an outline
and the edge or border of an element
 outline-styleSets the style of an outline
 outline-widthSets the width of an outline
Font property
Element Property
'font-family'
[[ <family-name> | <generic-family>] [, <family-name>| <generic-family>]* ] | inherit
Example: font-family: "Times New Roman", Times, serif;
'font-size'
<absolute-size> | <relative-size> |<length> |
keywords: xx-small, x-small, small, medium, large, x-large, xx-large.
size in pixel values (e.g. 12px, 16px, etc.)
'font-style' normal | italic | oblique | inherit
'font-variant' normal | small-caps | inherit
'font-weight'
normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
| inherit
'font'
[ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height']? 'font-family' ] |
caption | icon | menu | message-box | small-caption | status-bar | inherit
'height' <length> | <percentage> | auto |inherit
'letter-spacing' normal | <length> | inherit
'line-height' normal | <number> | <length> |<percentage> | inherit
Text propertyElement Property Initial value
'text-align' left | right | center | justify | inherit
a nameless value
that acts as 'left' if
'direction' is 'ltr',
'right' if 'direction' is
'rtl'
'text-decoration'
none | [ underline || overline || line-through || blink
] | inherit none
'text-indent' <length> | <percentage> | inherit 0
'text-transform' capitalize | uppercase | lowercase | none | inherit none
'text-align' left | right | center | justify | inherit
a nameless value
that acts as 'left' if
'direction' is 'ltr',
'right' if 'direction' is
'rtl'
The BOX Model
 The following diagram demonstrates how the margin, padding, and
border CSS properties determines how much space an element can
take on a web page.
CSS Margins
 The CSS margin properties are used to generate space
around elements.
 The margin properties set the size of the white space
outside the border.
 margin-top
 margin-right
 margin-bottom
 margin-left
 All the margin properties can have the following values:
 auto - the browser calculates the margin
 length - specifies a margin in px, pt, cm, etc.
 % - specifies a margin in % of the width of the containing element
 inherit - specifies that the margin should be inherited from the parent
element
CSS Margins
Example
 p {
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
}
Example shorthand
 p {
margin: 100px 150px 100px 80px;
margin: 25px 50px 75px 100px;
}
CSS Margins
 If the margin property has four values:
 margin: 25px 50px 75px 100px;
 top margin is 25px
 right margin is 50px
 bottom margin is 75px
 left margin is 100px
 If the margin property has three values:
 margin: 25px 50px 75px;
 top margin is 25px
 right and left margins are 50px
 bottom margin is 75px
 If the margin property has two values:
 margin: 25px 50px;
 top and bottom margins are 25px
 right and left margins are 50px
 If the margin property has one value:
 margin: 25px;
 all four margins are 25px
CSS Padding
 The CSS padding properties are used to generate space around content.
 The padding clears an area around the content (inside the border) of an element.
 CSS has properties for specifying the padding for each side of an element:
 padding-top
 padding-right
 padding-bottom
 padding-left
Example
p {
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}
Padding shorthand
 p {
padding: 50px 30px 50px 80px;
}
CSS Height and Width
 The height and width properties are used to set the height
and width of an element.
 The height and width can be set to auto (this is default.
Means that the browser calculates the height and width),
or be specified in length values, like px, cm, etc., or in
percent (%) of the containing block.
 Example
 div {
height: 200px;
width: 50%;
background-color: powderblue;
}
CSS Height and Width
 All CSS Dimension Properties
 Height Sets the height of an element
 max-height Sets the maximum height of an element
 max-width Sets the maximum width of an element
 min-height Sets the minimum height of an element
 min-width Sets the minimum width of an element
 Width Sets the width of an element
CSS Links
 With CSS, links can be styled in different ways.
links can be styled differently depending on
what state they are in.
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
CSS Links
Example
/* 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;
}
CSS Tables
Adding Borders to Tables
 The CSS border property is the best way to define the
borders for the tables.
 The following example will set a black border for
the <table>, <th>, and <td> elements.
Example
table, th, td {
border: 1px solid black;
}
CSS Tables
Adding Borders to Tables
 The border-collapse CSS property selects a table's border model.
 It can accept one of the two values collapse or separate.
 The separated model is the default HTML table border model in which
each Adjacent cells have their own distinct borders.
 In the collapsed border model, adjacent table cells share borders.
Example
table {
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
CSS Tables
 Striped Tables
 For zebra-striped tables, use the nth-child() selector and add
a background-color to all even (or odd) table rows:
Example
 tr:nth-child(even) {background-color: #f2f2f2}

More Related Content

What's hot (20)

Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3
Gheyath M. Othman
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
M Ashraful Islam Jewel
 
CSS tutorial chapter 2
CSS tutorial chapter 2CSS tutorial chapter 2
CSS tutorial chapter 2
jeweltutin
 
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
jeweltutin
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
Zoltan Iszlai
 
Cascading style sheets - CSS
Cascading style sheets - CSSCascading style sheets - CSS
Cascading style sheets - CSS
iFour Institute - Sustainable Learning
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
Santhiya Grace
 
Css
CssCss
Css
Vijay Raj Yanamala
 
CSS Part I
CSS Part ICSS Part I
CSS Part I
Doncho Minkov
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
tutorialsruby
 
Pemrograman Web 2 - CSS
Pemrograman Web 2 - CSSPemrograman Web 2 - CSS
Pemrograman Web 2 - CSS
Nur Fadli Utomo
 
Css
CssCss
Css
Er. Nawaraj Bhandari
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
Gheyath M. Othman
 
CSS
CSS CSS
CSS
Sunil OS
 
CSS
CSSCSS
CSS
People Strategists
 
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS Properties
Nosheen Qamar
 
CSS ppt
CSS pptCSS ppt
CSS ppt
Sanmuga Nathan
 

Similar to CSS Cascade Style Sheet (20)

gdg_workshop 4 on web development HTML & CSS
gdg_workshop 4 on web development HTML & CSSgdg_workshop 4 on web development HTML & CSS
gdg_workshop 4 on web development HTML & CSS
SaniyaKhan484230
 
CSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.ECSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
Web - CSS 1.pptx
Web - CSS 1.pptxWeb - CSS 1.pptx
Web - CSS 1.pptx
haroon451422
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptx
Tanu524249
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
Seble Nigussie
 
Art of css
Art of cssArt of css
Art of css
Raphael Wanjiku
 
Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3
Binu Paul
 
css front end development , designing web page
css front end development , designing web pagecss front end development , designing web page
css front end development , designing web page
Indu32
 
CSS presentation for beginners where they can understand easily
CSS presentation for beginners where they can understand easilyCSS presentation for beginners where they can understand easily
CSS presentation for beginners where they can understand easily
Indu32
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
SoniaJoshi25
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
MattMarino13
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
MattMarino13
 
Web Programming-css.pptx
Web Programming-css.pptxWeb Programming-css.pptx
Web Programming-css.pptx
MarwaAnany1
 
CSS
CSSCSS
CSS
Mallikarjuna G D
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
Jalpesh Vasa
 
css3.0.( Cascading Style Sheets ) pptx
css3.0.( Cascading  Style  Sheets ) pptxcss3.0.( Cascading  Style  Sheets ) pptx
css3.0.( Cascading Style Sheets ) pptx
neelkamal72809
 
Css Introduction
Css IntroductionCss Introduction
Css Introduction
SathyaseelanK1
 
CSS Comprehensive Overview
CSS Comprehensive OverviewCSS Comprehensive Overview
CSS Comprehensive Overview
Mohamed Loey
 
Css
CssCss
Css
Yudha Arif Budiman
 
gdg_workshop 4 on web development HTML & CSS
gdg_workshop 4 on web development HTML & CSSgdg_workshop 4 on web development HTML & CSS
gdg_workshop 4 on web development HTML & CSS
SaniyaKhan484230
 
CSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.ECSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptx
Tanu524249
 
Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3
Binu Paul
 
css front end development , designing web page
css front end development , designing web pagecss front end development , designing web page
css front end development , designing web page
Indu32
 
CSS presentation for beginners where they can understand easily
CSS presentation for beginners where they can understand easilyCSS presentation for beginners where they can understand easily
CSS presentation for beginners where they can understand easily
Indu32
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
MattMarino13
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
MattMarino13
 
Web Programming-css.pptx
Web Programming-css.pptxWeb Programming-css.pptx
Web Programming-css.pptx
MarwaAnany1
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
Jalpesh Vasa
 
css3.0.( Cascading Style Sheets ) pptx
css3.0.( Cascading  Style  Sheets ) pptxcss3.0.( Cascading  Style  Sheets ) pptx
css3.0.( Cascading Style Sheets ) pptx
neelkamal72809
 
CSS Comprehensive Overview
CSS Comprehensive OverviewCSS Comprehensive Overview
CSS Comprehensive Overview
Mohamed Loey
 

More from Adeel Rasheed (20)

Multan to Sukkur Motorway (M5)
Multan to Sukkur Motorway (M5)Multan to Sukkur Motorway (M5)
Multan to Sukkur Motorway (M5)
Adeel Rasheed
 
Religious Conflict
Religious ConflictReligious Conflict
Religious Conflict
Adeel Rasheed
 
R Studio (Report)
R Studio (Report)R Studio (Report)
R Studio (Report)
Adeel Rasheed
 
History of computer (1st to 5th Generations)
History of computer (1st to 5th Generations)History of computer (1st to 5th Generations)
History of computer (1st to 5th Generations)
Adeel Rasheed
 
Zooming and Its Types
Zooming and Its TypesZooming and Its Types
Zooming and Its Types
Adeel Rasheed
 
User Interface & Its Types
User Interface & Its TypesUser Interface & Its Types
User Interface & Its Types
Adeel Rasheed
 
Questions About Android Application Development
Questions About Android Application DevelopmentQuestions About Android Application Development
Questions About Android Application Development
Adeel Rasheed
 
Human and Machine Learning
Human and Machine LearningHuman and Machine Learning
Human and Machine Learning
Adeel Rasheed
 
Connection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion ControlConnection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion Control
Adeel Rasheed
 
IP Address - IPv4 & IPv6
IP Address - IPv4 & IPv6IP Address - IPv4 & IPv6
IP Address - IPv4 & IPv6
Adeel Rasheed
 
Computer Crime
Computer CrimeComputer Crime
Computer Crime
Adeel Rasheed
 
Privacy and Security Information
Privacy and Security InformationPrivacy and Security Information
Privacy and Security Information
Adeel Rasheed
 
Code of Conduct - Code of Practice & Standards
Code of Conduct - Code of Practice & StandardsCode of Conduct - Code of Practice & Standards
Code of Conduct - Code of Practice & Standards
Adeel Rasheed
 
Self Adaptive Systems
Self Adaptive SystemsSelf Adaptive Systems
Self Adaptive Systems
Adeel Rasheed
 
Ethernet - LAN
Ethernet - LANEthernet - LAN
Ethernet - LAN
Adeel Rasheed
 
Synchronous and Asynchronous Transmission
Synchronous and Asynchronous TransmissionSynchronous and Asynchronous Transmission
Synchronous and Asynchronous Transmission
Adeel Rasheed
 
Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#
Adeel Rasheed
 
Intel Microprocessors 8086 Documentation
Intel Microprocessors 8086 DocumentationIntel Microprocessors 8086 Documentation
Intel Microprocessors 8086 Documentation
Adeel Rasheed
 
Applications of Computer
Applications of ComputerApplications of Computer
Applications of Computer
Adeel Rasheed
 
Hysteresis Loop
Hysteresis LoopHysteresis Loop
Hysteresis Loop
Adeel Rasheed
 
Multan to Sukkur Motorway (M5)
Multan to Sukkur Motorway (M5)Multan to Sukkur Motorway (M5)
Multan to Sukkur Motorway (M5)
Adeel Rasheed
 
History of computer (1st to 5th Generations)
History of computer (1st to 5th Generations)History of computer (1st to 5th Generations)
History of computer (1st to 5th Generations)
Adeel Rasheed
 
Zooming and Its Types
Zooming and Its TypesZooming and Its Types
Zooming and Its Types
Adeel Rasheed
 
User Interface & Its Types
User Interface & Its TypesUser Interface & Its Types
User Interface & Its Types
Adeel Rasheed
 
Questions About Android Application Development
Questions About Android Application DevelopmentQuestions About Android Application Development
Questions About Android Application Development
Adeel Rasheed
 
Human and Machine Learning
Human and Machine LearningHuman and Machine Learning
Human and Machine Learning
Adeel Rasheed
 
Connection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion ControlConnection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion Control
Adeel Rasheed
 
IP Address - IPv4 & IPv6
IP Address - IPv4 & IPv6IP Address - IPv4 & IPv6
IP Address - IPv4 & IPv6
Adeel Rasheed
 
Privacy and Security Information
Privacy and Security InformationPrivacy and Security Information
Privacy and Security Information
Adeel Rasheed
 
Code of Conduct - Code of Practice & Standards
Code of Conduct - Code of Practice & StandardsCode of Conduct - Code of Practice & Standards
Code of Conduct - Code of Practice & Standards
Adeel Rasheed
 
Self Adaptive Systems
Self Adaptive SystemsSelf Adaptive Systems
Self Adaptive Systems
Adeel Rasheed
 
Synchronous and Asynchronous Transmission
Synchronous and Asynchronous TransmissionSynchronous and Asynchronous Transmission
Synchronous and Asynchronous Transmission
Adeel Rasheed
 
Classes and Objects in C#
Classes and Objects in C#Classes and Objects in C#
Classes and Objects in C#
Adeel Rasheed
 
Intel Microprocessors 8086 Documentation
Intel Microprocessors 8086 DocumentationIntel Microprocessors 8086 Documentation
Intel Microprocessors 8086 Documentation
Adeel Rasheed
 
Applications of Computer
Applications of ComputerApplications of Computer
Applications of Computer
Adeel Rasheed
 

Recently uploaded (20)

Issues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptxIssues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptx
Jalalkhan657136
 
UberEats clone app Development TechBuilder
UberEats clone app Development  TechBuilderUberEats clone app Development  TechBuilder
UberEats clone app Development TechBuilder
TechBuilder
 
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
gauravvmanchandaa200
 
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptxWhy-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Michael cole
 
VFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment detailsVFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment details
manojbkalla
 
Techdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk takerTechdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk taker
RajaNagendraKumar
 
What's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdfWhat's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdf
Ortus Solutions, Corp
 
Intranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We WorkIntranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We Work
BizPortals Solutions
 
Multiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdfMultiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdf
Nova Carter
 
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROIAutoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Udit Goenka
 
Key Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker SoftwareKey Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker Software
Insurance Tech Services
 
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjaraswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
muhammadalikhanalikh1
 
Offensive Security Penetration Testing
Offensive Security Penetration Testing        Offensive Security Penetration Testing
Offensive Security Penetration Testing
Purple Box
 
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
Philip Schwarz
 
Facility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS SoftwareFacility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS Software
TeroTAM
 
Software Risk and Quality management.pptx
Software Risk and Quality management.pptxSoftware Risk and Quality management.pptx
Software Risk and Quality management.pptx
HassanBangash9
 
Custom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdfCustom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdf
Digital Aptech
 
Shortcomings of EHS Software – And How to Overcome Them
Shortcomings of EHS Software – And How to Overcome ThemShortcomings of EHS Software – And How to Overcome Them
Shortcomings of EHS Software – And How to Overcome Them
TECH EHS Solution
 
German Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey resultsGerman Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey results
BradBedford3
 
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdfBoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
Ortus Solutions, Corp
 
Issues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptxIssues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptx
Jalalkhan657136
 
UberEats clone app Development TechBuilder
UberEats clone app Development  TechBuilderUberEats clone app Development  TechBuilder
UberEats clone app Development TechBuilder
TechBuilder
 
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
Risk Management in Software Projects: Identifying, Analyzing, and Controlling...
gauravvmanchandaa200
 
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptxWhy-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Michael cole
 
VFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment detailsVFP-Report-Copy-Data-Environment details
VFP-Report-Copy-Data-Environment details
manojbkalla
 
Techdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk takerTechdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk taker
RajaNagendraKumar
 
What's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdfWhat's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdf
Ortus Solutions, Corp
 
Intranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We WorkIntranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We Work
BizPortals Solutions
 
Multiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdfMultiple Platforms of Unity Game Development.pdf
Multiple Platforms of Unity Game Development.pdf
Nova Carter
 
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROIAutoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Udit Goenka
 
Key Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker SoftwareKey Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker Software
Insurance Tech Services
 
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjaraswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
muhammadalikhanalikh1
 
Offensive Security Penetration Testing
Offensive Security Penetration Testing        Offensive Security Penetration Testing
Offensive Security Penetration Testing
Purple Box
 
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
Philip Schwarz
 
Facility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS SoftwareFacility Management Solution - TeroTAM CMMS Software
Facility Management Solution - TeroTAM CMMS Software
TeroTAM
 
Software Risk and Quality management.pptx
Software Risk and Quality management.pptxSoftware Risk and Quality management.pptx
Software Risk and Quality management.pptx
HassanBangash9
 
Custom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdfCustom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdf
Digital Aptech
 
Shortcomings of EHS Software – And How to Overcome Them
Shortcomings of EHS Software – And How to Overcome ThemShortcomings of EHS Software – And How to Overcome Them
Shortcomings of EHS Software – And How to Overcome Them
TECH EHS Solution
 
German Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey resultsGerman Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey results
BradBedford3
 
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdfBoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
Ortus Solutions, Corp
 

CSS Cascade Style Sheet

  • 2. Adeel Rasheed Custom Web Application Developer  https://chauhantricks.blogspot.com  https://www.fiverr.com/adeelrasheed
  • 3. What is CSS? CSS stands for Cascading Style Sheets CSS describes how HTML elements are to be displayed on screen CSS saves a lot of work. It can control the layout of multiple web pages all at once
  • 4. CSS Syntax  A CSS comprises of style rules that are interpreted by the browser and then applied to the corresponding elements in your document.  A style rule is made of three parts −  Selector − A selector is an HTML tag at which a style will be applied. This could be any tag like <h1> or <table> etc.  Property - A property is a type of attribute of HTML tag. Put simply, all the HTML attributes are converted into CSS properties. They could be color, border etc.  Value - Values are assigned to properties. For example, colorproperty can have value either red or #F1F1F1 etc.
  • 5. CSS Syntax selector { property: value } You can put CSS Style Rule Syntax as follows − Example p { color: red; text-align: center; }
  • 6. CSS Selectors  Selectors are one of the most important aspects of CSS as they are used to select elements on a web page so that they can be styled. 1-Element Type Selector  An element type selector matches every instance of the element in the document tree with the corresponding element type name. Example p { color: blue; } 2-Id Selectors The id selector is used to define style rules for a single or unique element. The id selector is defined with a '#' (hash) sign immediately followed by the id value. Example #error { color: red; } 3-Class Selector  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. Example .center { text-align: center; color: red; }
  • 7. Inserting CSS Three Ways to Insert CSS  External style sheet  Internal style sheet  Inline style
  • 8. External Style Sheet  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:  The style sheet file must be saved with a .css extension. Example  <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head>
  • 9. Internal Style Sheet  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: Example  <head> <style> body { background-color: linen; } h1 { color: maroon; margin-left: 40px; } </style> </head>
  • 10. Inline Styles  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: Example  <h1 style="color:blue;margin-left:30px;">This is a heading.</h1>
  • 11. Color property Colors in CSS are most often specified by:  a valid color name - like "red"  an RGB value - like "rgb(255, 0, 0)"  a HEX value - like "#ff0000"
  • 12. Background property Element Property Initial value 'background-attachment' scroll | fixed | inherit scroll 'background-color' <color> | transparent | inherit transparent 'background-image' <url> | none | inherit none 'background-position' [ [ <percentage> | <length> | left | center | right ] [ <percentage> |<length> | top | center | bottom ]? ] | [ [ left | center | right ] || [ top | center | bottom ] ] | inherit 0% 0% 'background-repeat' repeat | repeat-x | repeat-y | no-repeat | inherit repeat 'background' ['background-color' || 'background- image' || 'background-repeat' ||'background- attachment' ||'background-position'] | inherit see individual properties
  • 13. Border propertyElement Property Initial value 'border-color' [ <color> | see individual properties 'border-spacing' <length> <length>? 0 'border-style' None,solid,dotted,dashed,double,groove,ridge, inset,outset,hidden see individual properties 'border-top''border-right''border- bottom''border-left' [ <border-width> || <border-style> ||'border-top- color' ] see individual properties 'border-top-color' 'border-right- color''border-bottom-color' 'border-left- color' <color> the value of the 'color' property 'border-top-style' 'border-right- style''border-bottom-style' 'border-left- style' <border-style> None 'border-top-width' 'border-right- width''border-bottom-width' 'border-left- width' <border-width> medium 'border-width' length in px, pt or cm or it should be set to thin, medium or thick. see individual properties 'border' [ <border-width> || <border-style> ||'border-color' ] see individual properties
  • 14. Round Border property Element Property Initial value 'border-radius’ In pixels see individual properties 'border-top-right-radius'‘ 'border-top-left-radius‘‘ 'border-botttom-right-radius'‘ 'border-bottom-left-radius‘‘ In pixels see individual properties
  • 15. Outline Property  An outline is a line that is drawn around elements (outside the borders) to make the element "stand out".  Similar to border  Outline Sets all the outline properties in one declaration  outline-color Sets the color of an outline  outline-offset Specifies the space between an outline and the edge or border of an element  outline-styleSets the style of an outline  outline-widthSets the width of an outline
  • 16. Font property Element Property 'font-family' [[ <family-name> | <generic-family>] [, <family-name>| <generic-family>]* ] | inherit Example: font-family: "Times New Roman", Times, serif; 'font-size' <absolute-size> | <relative-size> |<length> | keywords: xx-small, x-small, small, medium, large, x-large, xx-large. size in pixel values (e.g. 12px, 16px, etc.) 'font-style' normal | italic | oblique | inherit 'font-variant' normal | small-caps | inherit 'font-weight' normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit 'font' [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height']? 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit 'height' <length> | <percentage> | auto |inherit 'letter-spacing' normal | <length> | inherit 'line-height' normal | <number> | <length> |<percentage> | inherit
  • 17. Text propertyElement Property Initial value 'text-align' left | right | center | justify | inherit a nameless value that acts as 'left' if 'direction' is 'ltr', 'right' if 'direction' is 'rtl' 'text-decoration' none | [ underline || overline || line-through || blink ] | inherit none 'text-indent' <length> | <percentage> | inherit 0 'text-transform' capitalize | uppercase | lowercase | none | inherit none 'text-align' left | right | center | justify | inherit a nameless value that acts as 'left' if 'direction' is 'ltr', 'right' if 'direction' is 'rtl'
  • 18. The BOX Model  The following diagram demonstrates how the margin, padding, and border CSS properties determines how much space an element can take on a web page.
  • 19. CSS Margins  The CSS margin properties are used to generate space around elements.  The margin properties set the size of the white space outside the border.  margin-top  margin-right  margin-bottom  margin-left  All the margin properties can have the following values:  auto - the browser calculates the margin  length - specifies a margin in px, pt, cm, etc.  % - specifies a margin in % of the width of the containing element  inherit - specifies that the margin should be inherited from the parent element
  • 20. CSS Margins Example  p { margin-top: 100px; margin-bottom: 100px; margin-right: 150px; margin-left: 80px; } Example shorthand  p { margin: 100px 150px 100px 80px; margin: 25px 50px 75px 100px; }
  • 21. CSS Margins  If the margin property has four values:  margin: 25px 50px 75px 100px;  top margin is 25px  right margin is 50px  bottom margin is 75px  left margin is 100px  If the margin property has three values:  margin: 25px 50px 75px;  top margin is 25px  right and left margins are 50px  bottom margin is 75px  If the margin property has two values:  margin: 25px 50px;  top and bottom margins are 25px  right and left margins are 50px  If the margin property has one value:  margin: 25px;  all four margins are 25px
  • 22. CSS Padding  The CSS padding properties are used to generate space around content.  The padding clears an area around the content (inside the border) of an element.  CSS has properties for specifying the padding for each side of an element:  padding-top  padding-right  padding-bottom  padding-left Example p { padding-top: 50px; padding-right: 30px; padding-bottom: 50px; padding-left: 80px; } Padding shorthand  p { padding: 50px 30px 50px 80px; }
  • 23. CSS Height and Width  The height and width properties are used to set the height and width of an element.  The height and width can be set to auto (this is default. Means that the browser calculates the height and width), or be specified in length values, like px, cm, etc., or in percent (%) of the containing block.  Example  div { height: 200px; width: 50%; background-color: powderblue; }
  • 24. CSS Height and Width  All CSS Dimension Properties  Height Sets the height of an element  max-height Sets the maximum height of an element  max-width Sets the maximum width of an element  min-height Sets the minimum height of an element  min-width Sets the minimum width of an element  Width Sets the width of an element
  • 25. CSS Links  With CSS, links can be styled in different ways. links can be styled differently depending on what state they are in. 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
  • 26. CSS Links Example /* 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; }
  • 27. CSS Tables Adding Borders to Tables  The CSS border property is the best way to define the borders for the tables.  The following example will set a black border for the <table>, <th>, and <td> elements. Example table, th, td { border: 1px solid black; }
  • 28. CSS Tables Adding Borders to Tables  The border-collapse CSS property selects a table's border model.  It can accept one of the two values collapse or separate.  The separated model is the default HTML table border model in which each Adjacent cells have their own distinct borders.  In the collapsed border model, adjacent table cells share borders. Example table { border-collapse: collapse; } table, th, td { border: 1px solid black; }
  • 29. CSS Tables  Striped Tables  For zebra-striped tables, use the nth-child() selector and add a background-color to all even (or odd) table rows: Example  tr:nth-child(even) {background-color: #f2f2f2}