SlideShare a Scribd company logo
CSS for Styling HTML
Contents
CS380
1
Cascading Style Sheets (CSS)
 CSS use to describes the appearance, layout,
and presentation of information on a web page
 CSS Advantages:
2
•Separates structure from presentation
•Provides advanced control of presentation
•Easy maintenance of multiple pages
•Faster page loading
•Better accessibility for disabled users
•Easy to learn
Basic CSS rule syntax
 A CSS file consists of one or more rules
 Each rule starts with a selector
 A selector specifies an HTML element(s) and then
applies style properties to them
3
SYNTAX to Write CSS=
selector {
property: value;
...
property: value;
} CSS
Example===
p {
font-family: sans-serif;
color: red;
}
Types of CSS or
Attaching a Style Sheet
Attach a style sheet to a page by adding the code to the
<head> section of the HTML page. There are 3 ways to attach
CSS to a page:
1. External Style Sheet: Best used to control styling on multiple
pages.
<link rel="stylesheet" type="text/css"
media="all" href="css/styles.css" />
2. Internal Style Sheet: Best used to control styling on one page.
<style type=“text/css”>
h1 {color: red)
</style>
3. Inline Style Sheet*: CSS is not attached in the <header> but is
used directly within HTML tags.
<p style=“color: red”>Some Text</p>
Types of CSS- External CSS
 A page can link to multiple style sheet file.
 It uses Two fils-1 .CSS and 2. .HTML
5
P{color:red;} style.CSS
<head>
<link href="style.css" rel="stylesheet" /></head>
<body><p>This is External CSS</p>
.HTML
CS380
Internal CSS:
 It apply on Single Page.
 It uses <style> Tag in <head> and </head>.
6
<head>
<style>
p { font-family: arial;
color: red; }
h2 { background-color: yellow; }
</style>
</head> <body><h1>Internal CSS</h1>
<p>This is Internal CSS</p></body>
HTML
CS380
Inline styles: the style attribute
 It apply on single line of HTML code.
 It uses style as attribute.
 Higher precedence than internal or external CSS styles
7
<p style="font-family: chiller; color: red;">
This is a paragraph</p>
HTML
CS380
CSS properties for colors
8
p {
color: red;
background-color: yellow;
}
CSS
CS380
This paragraph uses the style above output
property description
color color of the element's text
background-color
color that will appear behind the
element
CSS comments /*…*/
9
/* This is a comment.
It can span many lines in the CSS file. */
p {
color: red; background-color: aqua;
} CSS
 CSS (like HTML) is usually not commented as rigorously
as programming languages such as Java
 The // single-line comment style is NOT supported in
CSS
 The <!-- ... --> HTML comment style is also NOT
supported in CSS
CS380
CSS properties for fonts
property description
font-family which font will be used
font-size how large the letters will be drawn
font-style used to enable/disable italic style
font-weight used to enable/disable bold style
CS380
10
<html>
<head><style>
p {
font-family :chiller;
font-size :20px;
font-style :italic;
font-weight :bold
} </style></head><body>
<p> This text formatted with font properties</p></body></html
Example:
CSS properties for text
property description
text-align alignment of text within its element
text-decoration decorations such as underlining
line-height,
word-spacing,
letter-spacing
gaps between the various portions
of the text
text-indent
indents the first letter of each
paragraph
CS380
11
Example
CS380
12
<html>
<head><style>
p {
line-height:12px;
Text-align: center;
Text-decoration:Overline;
Text-transform: uppercase;
word-spacing:20px;
letter-spacing:30px;
} </style></head><body>
<p> This text formatted with text properties</p></body></html
Example:
CSS properties for backgrounds
property description
background-color color to fill background
background-image image to place in background
background-position
placement of bg image within
element
background-repeat
whether/how bg image should be
repeated
CS380
13
Example:
CS380
14
<html>
<head><style>
body{
background-color:red;
Background-image:url(image1.jpg);
background-position:right;
Background-repeat:no-repeat;
Background-size: 200px 300px;
} </style></head><body>
<p> This page formatted with background
properties</p></body></html
CSS Box Model Properties:
CS380
15
property description
height To Change height of Section.
width To Change width of Section.
margin
Use to define margin space along
with four side
Padding
Use to define space along with
four side between border and
content.
Border
Use to define border around
content
Example:
CS380
16
<html>
<head><style>
div{
Hight:300px;
Width:300px;
Border: solid 20px red;
Margin-left:50px;
Padding:30px; //apply to for side
} </style></head><body>
<div>
<p> This section formatted with box model
properties</p></div></body></html

More Related Content

What's hot

CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)
Harshit Srivastava
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
Harshita Yadav
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to csseShikshak
 
Css
CssCss
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
Evolution Network
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
casestudyhelp
 
Cascading style sheet (css)]
Cascading style sheet (css)]Cascading style sheet (css)]
Cascading style sheet (css)]9574395990
 
Week 12 CSS - Review from last week
Week 12 CSS - Review from last weekWeek 12 CSS - Review from last week
Week 12 CSS - Review from last week
Katherine McCurdy-Lapierre, R.G.D.
 
CSS
CSS CSS
CSS
Sunil OS
 
HTML CSS Basics
HTML CSS BasicsHTML CSS Basics
HTML CSS Basics
Mai Moustafa
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Amit Tyagi
 
CSS Basics (Cascading Style Sheet)
CSS Basics (Cascading Style Sheet)CSS Basics (Cascading Style Sheet)
CSS Basics (Cascading Style Sheet)
Ajay Khatri
 
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
 
Introduction to web design discussing which languages is used for website des...
Introduction to web design discussing which languages is used for website des...Introduction to web design discussing which languages is used for website des...
Introduction to web design discussing which languages is used for website des...
Aditya Dwivedi
 

What's hot (20)

CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Css
CssCss
Css
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
Cascading style sheet (css)]
Cascading style sheet (css)]Cascading style sheet (css)]
Cascading style sheet (css)]
 
Week 12 CSS - Review from last week
Week 12 CSS - Review from last weekWeek 12 CSS - Review from last week
Week 12 CSS - Review from last week
 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 
CSS
CSS CSS
CSS
 
HTML CSS Basics
HTML CSS BasicsHTML CSS Basics
HTML CSS Basics
 
Css
CssCss
Css
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Css introduction
Css   introductionCss   introduction
Css introduction
 
CSS
CSSCSS
CSS
 
CSS Basics (Cascading Style Sheet)
CSS Basics (Cascading Style Sheet)CSS Basics (Cascading Style Sheet)
CSS Basics (Cascading Style Sheet)
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Introduction to web design discussing which languages is used for website des...
Introduction to web design discussing which languages is used for website des...Introduction to web design discussing which languages is used for website des...
Introduction to web design discussing which languages is used for website des...
 

Similar to Css basic

Html Styles-CSS
Html Styles-CSSHtml Styles-CSS
Html Styles-CSS
ispkosova
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
JohnpaulStem11
 
CSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slidesCSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slides
Aasma13
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
UsamaShakeel22
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
PramenathA
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
JohnSon872476
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssTesfaye Yenealem
 
Introduction to basics of css, overview, syntax and so on
Introduction to basics of css, overview, syntax and so onIntroduction to basics of css, overview, syntax and so on
Introduction to basics of css, overview, syntax and so on
mictnawaraj
 
Css
CssCss
Css
CssCss
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
TusharTikia
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Ameer Khan
 
Introduction to CSS in HTML.ppt
Introduction to CSS in HTML.pptIntroduction to CSS in HTML.ppt
Introduction to CSS in HTML.ppt
parveen837153
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
kassahungebrie
 
CSS.ppt
CSS.pptCSS.ppt
Css.html
Css.htmlCss.html

Similar to Css basic (20)

Html Styles-CSS
Html Styles-CSSHtml Styles-CSS
Html Styles-CSS
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
CSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slidesCSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slides
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Css
CssCss
Css
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
Introduction to basics of css, overview, syntax and so on
Introduction to basics of css, overview, syntax and so onIntroduction to basics of css, overview, syntax and so on
Introduction to basics of css, overview, syntax and so on
 
Css
CssCss
Css
 
Css
CssCss
Css
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Introduction to CSS in HTML.ppt
Introduction to CSS in HTML.pptIntroduction to CSS in HTML.ppt
Introduction to CSS in HTML.ppt
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
 
CSS.ppt
CSS.pptCSS.ppt
CSS.ppt
 
Css.html
Css.htmlCss.html
Css.html
 
Cascstylesheets
CascstylesheetsCascstylesheets
Cascstylesheets
 

Recently uploaded

一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
kecekev
 
Timeless Principles of Good Design
Timeless Principles of Good DesignTimeless Principles of Good Design
Timeless Principles of Good Design
Carolina de Bartolo
 
一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理
peuce
 
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
9a93xvy
 
Mohannad Abdullah portfolio _ V2 _22-24
Mohannad Abdullah  portfolio _ V2 _22-24Mohannad Abdullah  portfolio _ V2 _22-24
Mohannad Abdullah portfolio _ V2 _22-24
M. A. Architect
 
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
smpc3nvg
 
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
9a93xvy
 
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdfSECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
eloprejohn333
 
Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...
Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...
Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...
Mansi Shah
 
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANEEASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
Febless Hernane
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
n0tivyq
 
Can AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI preludeCan AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI prelude
Alan Dix
 
White wonder, Work developed by Eva Tschopp
White wonder, Work developed by Eva TschoppWhite wonder, Work developed by Eva Tschopp
White wonder, Work developed by Eva Tschopp
Mansi Shah
 
Moldes de letra 3D Alfabeto completo esp
Moldes de letra 3D Alfabeto completo espMoldes de letra 3D Alfabeto completo esp
Moldes de letra 3D Alfabeto completo esp
Hess9
 
Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page
Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page
Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page
pmgdscunsri
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
cy0krjxt
 
Graphic Design Tools and Software .pptx
Graphic Design Tools and Software   .pptxGraphic Design Tools and Software   .pptx
Graphic Design Tools and Software .pptx
Virtual Real Design
 
一比一原版(毕业证)早稻田大学毕业证成绩单如何办理
一比一原版(毕业证)早稻田大学毕业证成绩单如何办理一比一原版(毕业证)早稻田大学毕业证成绩单如何办理
一比一原版(毕业证)早稻田大学毕业证成绩单如何办理
taqyed
 
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
jyz59f4j
 
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
7sd8fier
 

Recently uploaded (20)

一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
 
Timeless Principles of Good Design
Timeless Principles of Good DesignTimeless Principles of Good Design
Timeless Principles of Good Design
 
一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理
 
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
 
Mohannad Abdullah portfolio _ V2 _22-24
Mohannad Abdullah  portfolio _ V2 _22-24Mohannad Abdullah  portfolio _ V2 _22-24
Mohannad Abdullah portfolio _ V2 _22-24
 
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
 
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
 
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdfSECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
 
Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...
Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...
Between Filth and Fortune- Urban Cattle Foraging Realities by Devi S Nair, An...
 
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANEEASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
 
Can AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI preludeCan AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI prelude
 
White wonder, Work developed by Eva Tschopp
White wonder, Work developed by Eva TschoppWhite wonder, Work developed by Eva Tschopp
White wonder, Work developed by Eva Tschopp
 
Moldes de letra 3D Alfabeto completo esp
Moldes de letra 3D Alfabeto completo espMoldes de letra 3D Alfabeto completo esp
Moldes de letra 3D Alfabeto completo esp
 
Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page
Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page
Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
 
Graphic Design Tools and Software .pptx
Graphic Design Tools and Software   .pptxGraphic Design Tools and Software   .pptx
Graphic Design Tools and Software .pptx
 
一比一原版(毕业证)早稻田大学毕业证成绩单如何办理
一比一原版(毕业证)早稻田大学毕业证成绩单如何办理一比一原版(毕业证)早稻田大学毕业证成绩单如何办理
一比一原版(毕业证)早稻田大学毕业证成绩单如何办理
 
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
 
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
 

Css basic

  • 1. CSS for Styling HTML Contents CS380 1
  • 2. Cascading Style Sheets (CSS)  CSS use to describes the appearance, layout, and presentation of information on a web page  CSS Advantages: 2 •Separates structure from presentation •Provides advanced control of presentation •Easy maintenance of multiple pages •Faster page loading •Better accessibility for disabled users •Easy to learn
  • 3. Basic CSS rule syntax  A CSS file consists of one or more rules  Each rule starts with a selector  A selector specifies an HTML element(s) and then applies style properties to them 3 SYNTAX to Write CSS= selector { property: value; ... property: value; } CSS Example=== p { font-family: sans-serif; color: red; }
  • 4. Types of CSS or Attaching a Style Sheet Attach a style sheet to a page by adding the code to the <head> section of the HTML page. There are 3 ways to attach CSS to a page: 1. External Style Sheet: Best used to control styling on multiple pages. <link rel="stylesheet" type="text/css" media="all" href="css/styles.css" /> 2. Internal Style Sheet: Best used to control styling on one page. <style type=“text/css”> h1 {color: red) </style> 3. Inline Style Sheet*: CSS is not attached in the <header> but is used directly within HTML tags. <p style=“color: red”>Some Text</p>
  • 5. Types of CSS- External CSS  A page can link to multiple style sheet file.  It uses Two fils-1 .CSS and 2. .HTML 5 P{color:red;} style.CSS <head> <link href="style.css" rel="stylesheet" /></head> <body><p>This is External CSS</p> .HTML CS380
  • 6. Internal CSS:  It apply on Single Page.  It uses <style> Tag in <head> and </head>. 6 <head> <style> p { font-family: arial; color: red; } h2 { background-color: yellow; } </style> </head> <body><h1>Internal CSS</h1> <p>This is Internal CSS</p></body> HTML CS380
  • 7. Inline styles: the style attribute  It apply on single line of HTML code.  It uses style as attribute.  Higher precedence than internal or external CSS styles 7 <p style="font-family: chiller; color: red;"> This is a paragraph</p> HTML CS380
  • 8. CSS properties for colors 8 p { color: red; background-color: yellow; } CSS CS380 This paragraph uses the style above output property description color color of the element's text background-color color that will appear behind the element
  • 9. CSS comments /*…*/ 9 /* This is a comment. It can span many lines in the CSS file. */ p { color: red; background-color: aqua; } CSS  CSS (like HTML) is usually not commented as rigorously as programming languages such as Java  The // single-line comment style is NOT supported in CSS  The <!-- ... --> HTML comment style is also NOT supported in CSS CS380
  • 10. CSS properties for fonts property description font-family which font will be used font-size how large the letters will be drawn font-style used to enable/disable italic style font-weight used to enable/disable bold style CS380 10 <html> <head><style> p { font-family :chiller; font-size :20px; font-style :italic; font-weight :bold } </style></head><body> <p> This text formatted with font properties</p></body></html Example:
  • 11. CSS properties for text property description text-align alignment of text within its element text-decoration decorations such as underlining line-height, word-spacing, letter-spacing gaps between the various portions of the text text-indent indents the first letter of each paragraph CS380 11
  • 12. Example CS380 12 <html> <head><style> p { line-height:12px; Text-align: center; Text-decoration:Overline; Text-transform: uppercase; word-spacing:20px; letter-spacing:30px; } </style></head><body> <p> This text formatted with text properties</p></body></html Example:
  • 13. CSS properties for backgrounds property description background-color color to fill background background-image image to place in background background-position placement of bg image within element background-repeat whether/how bg image should be repeated CS380 13
  • 15. CSS Box Model Properties: CS380 15 property description height To Change height of Section. width To Change width of Section. margin Use to define margin space along with four side Padding Use to define space along with four side between border and content. Border Use to define border around content
  • 16. Example: CS380 16 <html> <head><style> div{ Hight:300px; Width:300px; Border: solid 20px red; Margin-left:50px; Padding:30px; //apply to for side } </style></head><body> <div> <p> This section formatted with box model properties</p></div></body></html

Editor's Notes

  1. 4
  2. a conflict (two sheets define a style for the same HTML element