SlideShare a Scribd company logo
1 of 8
Download to read offline
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
1
Chapter 4
CSS (Cascading Style Sheets)
‫لغة‬C S S‫هلف‬ ‫ضون‬ ‫او‬ ‫هسحقل‬ ‫هلف‬ ‫في‬ ‫هكحوبة‬ ‫األواهر‬ ‫هن‬ ‫هجووعة‬ ‫هي‬H T M L,
. ‫العول‬ ‫بيئة‬ ‫بحسب‬ , ‫اإللكحرونية‬ ‫للظفحة‬ ‫العبم‬ ‫الشكل‬ ‫جعذيل‬ ‫خالله‬ ‫هن‬ ‫يوكنك‬
‫من‬ ‫الفائدة‬CSS:
1-‫طفحبت‬ ‫هن‬ ‫كبير‬ ‫عذد‬ ‫جعذيل‬ ‫جسحطيع‬H T M L. ‫فقط‬ ‫واحذ‬ ‫هلف‬ ‫هن‬
2-‫عول‬ ‫بيئة‬ ‫لكل‬ , ‫شكل‬ ‫وضع‬.
3-‫هلف‬ ‫حجن‬ ‫جقليل‬H T M L‫هلف‬ ‫في‬ ‫الخظبئض‬ ‫بعرع‬ ‫ورلك‬ ,C S S. ‫هسحقل‬
4-. ‫قظير‬ ‫بوقث‬ ‫جغييرهب‬ ‫واهكبنية‬ , ‫والظور‬ ‫ببلنظوص‬ ‫الكبهل‬ ‫الححكن‬
CSS Syntax
A CSS rule-set consists of a selector and a declaration block:
The selector points to the HTML element you want to style.
The declaration block contains one or more declarations separated by semicolons.
Each declaration includes a CSS property name and a value, separated by a colon.
A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by
curly braces.
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
2
Example:
p {
color: red;
text-align: center;
}
CSS Selectors
CSS selectors are used to "find" (or select) HTML elements based on
their element name, id, class, attribute, and more.
1. The element Selector: The element selector selects elements
based on the element name.
You can select all <p> elements on a page like this (in this case, all <p>
elements will be center-aligned, with a red text color):
Example:
<html>
<head>
<style>
p {
text-align: center;
color: red;
}
</style>
</head>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
3
<body>
<p>Every paragraph will be affected by the style.</p>
<p id="para1">Me too!</p>
<p>And me!</p>
</body>
</html>
2. The id Selector
 The id selector uses the id attribute of an HTML element to select
a specific element.
 The id of an element should be unique within a page, so the id
selector is used to select one unique element!
 To select an element with a specific id, write a hash (#) character,
followed by the id of the element.
The style rule below will be applied to the HTML element with
id="para1":
<html>
<head>
<style>
#para1 {
text-align: center;
color: red;
}
</style>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
4
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
3. The 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.
In the example below, all HTML elements with class="center" will be
red and center-aligned:
<html>
<head>
<style>
.center {
text-align: center;
color: red;
}
</style>
</head>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
5
<body>
<h1 class="center">Red and center-aligned heading</h1>
<p class="center">Red and center-aligned paragraph.</p>
</body>
</html>
You can also specify that only specific HTML elements should be
affected by a class.
In the example below, only <p> elements with class="center" will be
center-aligned:
<html>
<head>
<style>
p.center {
text-align: center;
color: red;
}
</style>
</head>
<body>
<h1 class="center">This heading will not be affected</h1>
<p class="center">This paragraph will be red and center-aligned.</p>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
6
</body>
</html>
Three Ways to Insert CSS
There are three ways of inserting a style sheet:
 External style sheet
 Internal style sheet
 Inline style
1. 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:
<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>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
7
An external style sheet can be written in any text editor. The file should
not contain any html tags. The style sheet file must be saved with a .css
extension.
Here is how the "myStyle.css" looks:
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
2. 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:
<html>
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
8
margin-left: 40px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
3. 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:
<html>
<body>
<h1 style="color:blue;margin-left:30px;">This is a heading.</h1>
<p>This is a paragraph.</p>
</body>
</html>

More Related Content

What's hot (20)

HTML- Hyper Text Markup Language
HTML- Hyper Text Markup LanguageHTML- Hyper Text Markup Language
HTML- Hyper Text Markup Language
 
HTML CSS | Computer Science
HTML CSS | Computer ScienceHTML CSS | Computer Science
HTML CSS | Computer Science
 
CSS
CSSCSS
CSS
 
Introduction of css
Introduction of cssIntroduction of css
Introduction of css
 
Css
CssCss
Css
 
Html & CSS
Html & CSSHtml & CSS
Html & CSS
 
Turorial css
Turorial cssTurorial css
Turorial css
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Cit 230 internal css
Cit 230 internal cssCit 230 internal css
Cit 230 internal css
 
Week3 css
Week3 cssWeek3 css
Week3 css
 
HTML and CSS
HTML and CSSHTML and CSS
HTML and CSS
 
CSS introduction
CSS introductionCSS introduction
CSS introduction
 
Html and css
Html and cssHtml and css
Html and css
 
Basic HTML/CSS
Basic HTML/CSSBasic HTML/CSS
Basic HTML/CSS
 
Cascading Style Sheet | CSS
Cascading Style Sheet | CSSCascading Style Sheet | CSS
Cascading Style Sheet | CSS
 
Html & CSS - Best practices 2-hour-workshop
Html & CSS - Best practices 2-hour-workshopHtml & CSS - Best practices 2-hour-workshop
Html & CSS - Best practices 2-hour-workshop
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Web Development - Lecture 2
Web Development - Lecture 2Web Development - Lecture 2
Web Development - Lecture 2
 
CSS Basic Introduction, Rules, And Tips
CSS Basic Introduction, Rules, And TipsCSS Basic Introduction, Rules, And Tips
CSS Basic Introduction, Rules, And Tips
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 

Viewers also liked

Viewers also liked (12)

Week 8
Week 8Week 8
Week 8
 
internet basics
internet basics internet basics
internet basics
 
STEVE JOBS El genio de la innovación
STEVE JOBS El genio de la innovaciónSTEVE JOBS El genio de la innovación
STEVE JOBS El genio de la innovación
 
HTML-Part2
HTML-Part2HTML-Part2
HTML-Part2
 
Eric Kabukuru's defense
Eric Kabukuru's defenseEric Kabukuru's defense
Eric Kabukuru's defense
 
Viaje virtual power
Viaje virtual powerViaje virtual power
Viaje virtual power
 
Heroin
HeroinHeroin
Heroin
 
Introdução a adm burocracia
Introdução a adm burocraciaIntrodução a adm burocracia
Introdução a adm burocracia
 
Project outline
Project outlineProject outline
Project outline
 
Los sueños
Los sueñosLos sueños
Los sueños
 
Manual de formacao_de_tecnicos_de_campo[2]
Manual de formacao_de_tecnicos_de_campo[2]Manual de formacao_de_tecnicos_de_campo[2]
Manual de formacao_de_tecnicos_de_campo[2]
 
Teoria geral da burocracia burocracia
Teoria geral da burocracia burocraciaTeoria geral da burocracia burocracia
Teoria geral da burocracia burocracia
 

Similar to CSS

Css introduction
Css introductionCss introduction
Css introductionSridhar P
 
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
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Erin M. Kidwell
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)Webtech Learning
 
BITM3730Week4.pptx
BITM3730Week4.pptxBITM3730Week4.pptx
BITM3730Week4.pptxMattMarino13
 
CLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMINGCLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMINGProf Ansari
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style SheetsMukesh Tekwani
 
Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8RohanMistry15
 
Html, css and jquery introduction
Html, css and jquery introductionHtml, css and jquery introduction
Html, css and jquery introductioncncwebworld
 
Css tutorial
Css tutorialCss tutorial
Css tutorialvedaste
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simpleJagadishBabuParri
 
Cascading style sheet an introduction
Cascading style sheet   an introductionCascading style sheet   an introduction
Cascading style sheet an introductionHimanshu Pathak
 

Similar to CSS (20)

CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
Css introduction
Css introductionCss introduction
Css introduction
 
Css
CssCss
Css
 
chitra
chitrachitra
chitra
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to 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...
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
BITM3730Week4.pptx
BITM3730Week4.pptxBITM3730Week4.pptx
BITM3730Week4.pptx
 
CSS.ppt
CSS.pptCSS.ppt
CSS.ppt
 
CLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMINGCLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMING
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8
 
Html, css and jquery introduction
Html, css and jquery introductionHtml, css and jquery introduction
Html, css and jquery introduction
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
 
Cascading style sheet an introduction
Cascading style sheet   an introductionCascading style sheet   an introduction
Cascading style sheet an introduction
 
Web Designing
Web DesigningWeb Designing
Web Designing
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 

More from Ahmed Saihood (9)

Sessions &Cookies
Sessions &CookiesSessions &Cookies
Sessions &Cookies
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
PHP-Part3
PHP-Part3PHP-Part3
PHP-Part3
 
PHP-Part2
PHP-Part2PHP-Part2
PHP-Part2
 
HTTP & HTTPs
HTTP & HTTPsHTTP & HTTPs
HTTP & HTTPs
 
PHP-Part1
PHP-Part1PHP-Part1
PHP-Part1
 
XHTML
XHTMLXHTML
XHTML
 
HTML-Forms
HTML-FormsHTML-Forms
HTML-Forms
 
HTML-Part1
HTML-Part1HTML-Part1
HTML-Part1
 

Recently uploaded

Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Sheetaleventcompany
 

Recently uploaded (20)

Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 

CSS

  • 1. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 1 Chapter 4 CSS (Cascading Style Sheets) ‫لغة‬C S S‫هلف‬ ‫ضون‬ ‫او‬ ‫هسحقل‬ ‫هلف‬ ‫في‬ ‫هكحوبة‬ ‫األواهر‬ ‫هن‬ ‫هجووعة‬ ‫هي‬H T M L, . ‫العول‬ ‫بيئة‬ ‫بحسب‬ , ‫اإللكحرونية‬ ‫للظفحة‬ ‫العبم‬ ‫الشكل‬ ‫جعذيل‬ ‫خالله‬ ‫هن‬ ‫يوكنك‬ ‫من‬ ‫الفائدة‬CSS: 1-‫طفحبت‬ ‫هن‬ ‫كبير‬ ‫عذد‬ ‫جعذيل‬ ‫جسحطيع‬H T M L. ‫فقط‬ ‫واحذ‬ ‫هلف‬ ‫هن‬ 2-‫عول‬ ‫بيئة‬ ‫لكل‬ , ‫شكل‬ ‫وضع‬. 3-‫هلف‬ ‫حجن‬ ‫جقليل‬H T M L‫هلف‬ ‫في‬ ‫الخظبئض‬ ‫بعرع‬ ‫ورلك‬ ,C S S. ‫هسحقل‬ 4-. ‫قظير‬ ‫بوقث‬ ‫جغييرهب‬ ‫واهكبنية‬ , ‫والظور‬ ‫ببلنظوص‬ ‫الكبهل‬ ‫الححكن‬ CSS Syntax A CSS rule-set consists of a selector and a declaration block: The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon. A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces.
  • 2. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 2 Example: p { color: red; text-align: center; } CSS Selectors CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class, attribute, and more. 1. The element Selector: The element selector selects elements based on the element name. You can select all <p> elements on a page like this (in this case, all <p> elements will be center-aligned, with a red text color): Example: <html> <head> <style> p { text-align: center; color: red; } </style> </head>
  • 3. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 3 <body> <p>Every paragraph will be affected by the style.</p> <p id="para1">Me too!</p> <p>And me!</p> </body> </html> 2. The id Selector  The id selector uses the id attribute of an HTML element to select a specific element.  The id of an element should be unique within a page, so the id selector is used to select one unique element!  To select an element with a specific id, write a hash (#) character, followed by the id of the element. The style rule below will be applied to the HTML element with id="para1": <html> <head> <style> #para1 { text-align: center; color: red; } </style>
  • 4. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 4 </head> <body> <p id="para1">Hello World!</p> <p>This paragraph is not affected by the style.</p> </body> </html> 3. The 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. In the example below, all HTML elements with class="center" will be red and center-aligned: <html> <head> <style> .center { text-align: center; color: red; } </style> </head>
  • 5. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 5 <body> <h1 class="center">Red and center-aligned heading</h1> <p class="center">Red and center-aligned paragraph.</p> </body> </html> You can also specify that only specific HTML elements should be affected by a class. In the example below, only <p> elements with class="center" will be center-aligned: <html> <head> <style> p.center { text-align: center; color: red; } </style> </head> <body> <h1 class="center">This heading will not be affected</h1> <p class="center">This paragraph will be red and center-aligned.</p>
  • 6. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 6 </body> </html> Three Ways to Insert CSS There are three ways of inserting a style sheet:  External style sheet  Internal style sheet  Inline style 1. 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: <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>
  • 7. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 7 An external style sheet can be written in any text editor. The file should not contain any html tags. The style sheet file must be saved with a .css extension. Here is how the "myStyle.css" looks: body { background-color: lightblue; } h1 { color: navy; margin-left: 20px; } 2. 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: <html> <head> <style> body { background-color: linen; } h1 { color: maroon;
  • 8. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood 8 margin-left: 40px; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> 3. 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: <html> <body> <h1 style="color:blue;margin-left:30px;">This is a heading.</h1> <p>This is a paragraph.</p> </body> </html>