SlideShare a Scribd company logo
Introduction
To CSS
by: Alexandra Vlachakis
Sandy Creek High School, Fayette County Schools
Content and Resources Used With Permission:
Interact With Web Standards. Copyright 2010. Erin Anderson et. Al.
W3 Schools. www.w3schools.com. 12-25-11.
HTML Review
► What

is HTML used for?
► Give some examples of formatting tags in
HTML?
► HTML is the most widely used language on the
Web
► In today’s lesson we will be discussing the
second most widely used language on the web
► Does anyone know the name of the second most
widely used language?
Lesson 1: History of CSS
► CSS

was proposed in 1994 as a web styling
language. To helps solve some of the
problems HTML 4.
► There were other styling languages
proposed at this time, such as Style Sheets
for HTML and JSSS but CSS won.
► CSS2 became the recommendation in 1998
by W3C
► CSS3 was started in 1998 but it has never
been completed. Some parts are still being
developed and some components work on
some browsers.
Lesson 1: What is CSS?
• CSS stands for Cascading Style Sheets
• Styles - define how to display HTML elements
• Styles are normally stored in Style Sheets
Definition:

Cascading Style Sheets (CSS) – is a rule based
language that applies styling to your HTML elements.
You write CSS rules in elements, and modify properties
of those elements such as color, background color,
width, border thickness, font size, etc.
Lesson 1: Examples of
CSS
►
►
►

►
►
►
►
►
►

►

Example 1: http://www.csszengarden.com/
Example 2: http://w3schools.com/css/demo_default.htm
If you notice each time we click on a different CSS style sheet on the
two pages above the look and feel of each page changes dramatically
but the content stays the same.
HTML did not offer us this option.
HTML was never intended to contain tags for formatting a document.
HTML was intended to define the content of a document, like:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
When tags like <font>, and color attributes were added to the HTML
3.2 specification, it started a nightmare for web developers.
Development of large web sites, where fonts and color information
were added to every single page, became a long and expensive
process.
To solve this problem, the World Wide Web Consortium (W3C) created
CSS.
HTML Formatting Review
► What are the starting tags in HTML?
► What are the ending tags in HTML?
► How do you save in a Notepad document so it

becomes a web page?
► What is the tag for creating paragraphs in
HTML?
► What is the tag for creating heading tags in
HTML?
► What are the tags we use to format font: family,
color,  size, alignment in HTML?
Lesson 2: Syntax oF CSS


The CSS syntax is made up of 5 parts:







selector
property/value
declaration
declaration block
curly braces

We will explore each part in the next slides.
Selector
 Definition: identifies the HTML elements that the
rule will be applied to, identified by the actual
element name, e.g. <body>, or by other means
such as class attribute values.
 Example:

*The selector is normally the HTML element you want to style
Property & Value
 Definition: The property is the style attribute you
want to change. Each property has a value.

*Properties are separated from their respective values by
colons :
*Pairs are separated from each other by semicolons ;
Declaration
 Definition: Each CSS line that includes property
and value

*Each declaration consists of a property and a value.
Declaration Block
Definition: multiple declaration lines including the
curly braces
Curly Braces
 Definition: the curly braces contain the
properties of the element you want to
manipulate, and the values that you want to
change them to. The curly braces plus their
content is called a declaration block.
 Example:
Lesson 2 Assignment:
Let’s Create Our First CSS Page
►
►

Open Notepad
Type the following Code

<html>
<head>
<style type="text/css">
p {color:red; text-align:center;}
</style>
</head>
<body>
<p>Hello World!</p>
<p>This paragraph is styled with CSS.</p>
</body>
</html>
►

►Instructor Note: You can

demonstrate how to do this by
using the example given on the
W3schools site. Also as you are
creating this file point out to
students where they will find the
different syntax found in CSS.
►After creating the file have
students manipulate the color and
alignment values.

Save Your File as css-myfirstpage.html into a new folder called CSS


Lesson 3: Class and id
Selectors
In addition to setting a style for a HTML element, CSS allows
you to specify your own selectors called "id" and "class".

id - The id selector is used to specify a style for a single, unique
element.


The id selector uses the id attribute of the HTML element,
and is defined with a "#".



The style rule below will be applied to the element with
id="para1":



#para1 {text-align:center;color:red;}
Lesson 3: Class and id
Selectors
Class - The class selector is used to specify a style for a group

of elements. Unlike the id selector, the class selector is most
often used on several elements.



This allows you to set a particular style for any HTML
elements with the same class.



The class selector uses the HTML class attribute, and is
defined with a "."



In the example below, all HTML elements with class="center"
will be center-aligned:



.center {text-align:center;}


Lesson 3: Class and id
Selectors

In the image below what is the h1 selector
an ID or a Class?

#

.
Lesson 3 Assignment:
Let’s Create A CSS Page that uses “id”
Open Notepad
► Type the following Code
►

<html>
<head>
<style type="text/css">
#para1
{
text-align:center;
color:red;
}
</style>
</head>

►Instructor Note: You can

demonstrate how to do this by
using the example given on the
W3schools site. Also as you are
creating this file point out to
students where they will find the
different syntax found in CSS
►After creating the file have
students manipulate the name of
the “id”

<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
►

Save Your File as css-id.html into a your folder called CSS.
Lesson 3 Assignment:
Let’s Create A CSS Page that uses “class”
Open Notepad
► Type the following Code
►

<html>
<head>
<style type="text/css">
.center
{
text-align:center;
}
</style>
</head>

►Instructor Note: You can

demonstrate how to do this by
using the example given on the
W3schools site. Also as you are
creating this file point out to
students where they will find the
different syntax found in CSS
►After creating the file have
students manipulate the name of
the “class”

<body>
<h1 class="center">Center-aligned heading</h1>
<p class="center">Center-aligned paragraph.</p>
</body>
</html>
►

Save Your File as css-class.html into a your folder called CSS.
Lesson 3 Comments
►

Comments are used to explain your code, and may help you when you edit
the source code at a later date. Comments are ignored by browsers.

You add comments by enclosing them in
/* and */

►

►

Comments can span several lines, and the browser will ignore these lines.

►

Example:

/* This is a basic comment it will not appear on the page*/   
 /* starts the comment
*/ is the end of the comment
►

/*This is a comment*/
p{ text-align:center; color:black; font-family:arial;}
Lesson 3 Assignment:
Let’s Add A Comment
►
►

Open Your CSS-ID example in Notepad
Type the following Code right above the style you had written previously.

<html>
<head>

/*This is an example of how to use ID in a CSS web page*/
<style type="text/css">
#para1
{
text-align:center;
color:red;
}
</style>
</head>

<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
►

Save Your File as css-comment.html into a your folder called CSS.
Page

Lesson 4: How CSS is Applied to A Web

► CSS is applied to a web page using three

different methods:




Inline style
Internal style sheet
External style sheet
Lesson 4: How CSS is Applied to A Web
Page
► Inline CSS
► Applies styles directly to the elements by

adding declarations into the style
► For Example:
<p style=“color: red;”> This is a simple
paragraph and the inline style makes it
red.</p>
Lesson 4: How CSS is Applied to A Web
Page
Internal Style Sheet
► Applies styles to HTML by placing the CSS rules inside the tag
<style> inside the document tag <head>.
► For Example:
<head>
<title>my page</title>
<style type=“text/css”>
p{color:red}</style>
</head>
<body>
<p>this is a simple paragraph
</p>
</body>
►
Lesson 4: How CSS is Applied to A Web
Page
External CSS
► Applies styles as a separate file with a .css extension. The file is
then referenced from inside the <head> element by a link to the
file.
► For Example:
<head>
<title>my external style sheet page</title>
<link rel=“style sheet” type=“text/css” href=“my-externalstylesheet.css”>
<body>
<p>this is a simple paragraph</p>
</body>
► You can create an external style sheet in your text editor.
►
Lesson 4: How CSS is Applied to A Web
Page
What style sheet is best?
► Web developers rarely use inline CSS. Since they prefer
to not mix content with presentation. And it is not
efficient since you have to declare the style individually
for every component.
►

►

Internal and External style sheets are more popular
because you can style multiple elements with one rule.

►

External style sheets are best because they allow you to
save all the style information on a separate file from the
content. You can then modify a style for a site and it will
update all of the pages in a site.
Lesson 5: Colors and Formatting in CSS
► CSS Colors
► In the previous lesson you have seen a few

CSS styles that included color like: <p
style=“color: red;”>
► There are a few ways that you can set
colors in CSS:
Keywords, Hex values, RGB, HSL(a)
Lesson 5: Colors and Formatting in CSS
► CSS Colors: Keywords
► Using the keywords like: red, fuchsia, yellow,

blue, green you can specify what color you would
like the CSS rule to display.
► For example:
► p{color:red}
► h2{color:yellow}
► There are 17 of these keyword colors you can
use in CSS.
Lesson 5: Colors and Formatting in CSS
Keyword Color

Hex

aqua

#00ffff

black

#000000

blue

#0000ff

fuchsia

#ff00ff

gray

#808080

green

#008000

lime

#00ff00

maroon

#800000

navy

#000080

olive

#808000

orange (added in CSS 2.1)

#ffa500

purple

#800080

red

#ff0000

silver

#c0c0c0

teal

#008080

white

#ffffff

yellow

#ffff00
Lesson 5: Colors and Formatting in CSS
► Computers are capable of displaying a lot more

than 17 colors.
► In fact they can display approximately 16.7
million colors!
► Hex Values (hex is short for hexadecimal) are
the most common way of specifying colors for
web pages. (see hex# in the previous chart)
► For example:
p{color: #000000;}
/*This is equivalent to the keyword black*/
Lesson 5: Colors and Formatting in CSS
► Hex numbers - has 16 possible values
► 0 to 9 then A to F. Which gives you 16

values.
► RGB (Red Green Blue) has the possibility
of 256 colors for each (16x16)
► (R)256 x (G)256 x (B)256 = 16,777,216 or
16.7 million color values
► CSS example: h1{color: #000000;}
Lesson 5: Colors and Formatting in CSS
► RGB (a) can also help specify colors in CSS

RGB stands for Red Green Blue
► You can specify RGB in either whole numbers or
percentages
► CSS example: h1{color: rgb(0,0,0) }
/*this color is equivalent to #000000 or black */
► You use numbers from 0 to 255 which covers the
256 color range.
► More examples can be found at:
http://www.w3schools.com/css/css_colors.asp
Lesson 5: Colors and Formatting in CSS
RGB (a) can also help specify colors in CSS RGB
stands for Red Green Blue. The “a” stands for alpha but
we will learn about that in another lesson.
► You can specify RGB in either whole numbers or
percentages
► CSS example: h1{color: rgb(0,0,0) }
/*this color is equivalent to #000000 or black */
► You use numbers from 0 to 255 which covers the 256
color range.
► More examples can be found at:
http://www.w3schools.com/css/css_colors.asp
►
Lesson 5: Colors and Formatting in CSS
► HSL (a) - Hue Saturation Lightness
► Similar to RGB but based on saturation and

lightness of a color
► The “a” stands for alpha but we will learn about
that in another lesson.
► CSS example: h1{color: hsl(0,100%,40%) }
► HSL accepts a number between 0 to 360 in value
► HSL also accepts percentage between 0-100%
Lesson 5 Assignment:
CSS Using Color
►
►

Open Your CSS-ID example in Notepad
Type the following Code right above the style you had written previously.

<html>
<body>
<p style="background-color:#FFF111">
Color set by using hex value
</p>
<p style="background-color:rgb(0,255,0);">
Color set by using rgb value
</p>
<p style="background-color:red">
Color set by using color name
</p>

►Instructor Note: You can

demonstrate how to do this by
using the example given on the
W3schools site. Also as you are
creating this file point out to
students the different syntax found
in CSS.
►After creating the file have
students manipulate the color
values to discover other color
combinations.

</body>
</html>
► Save Your File as css-color.html into your folder called CSS
► Essential Questions Review

More Related Content

What's hot

Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
SSN College of Engineering, Kalavakkam
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Prarthan P
 
Hushang Gaikwad
Hushang GaikwadHushang Gaikwad
Hushang Gaikwad
Hushnag Gaikwad
 
DHTML
DHTMLDHTML
Css presentation lecture 1
Css presentation lecture 1Css presentation lecture 1
Css presentation lecture 1
Mudasir Syed
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
ShreyaShetty92
 
Introduction to html course digital markerters
Introduction to html course digital markertersIntroduction to html course digital markerters
Introduction to html course digital markerters
SEO SKills
 
Html and css presentation
Html and css presentationHtml and css presentation
Html and css presentation
umesh patil
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
Knoldus Inc.
 
Unit 2 dhtml
Unit 2 dhtmlUnit 2 dhtml
Unit 2 dhtml
Sarthak Varshney
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
Himanshu Kumar
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Ann Alcid
 
Lesson 1: Introduction to HTML
Lesson 1: Introduction to HTMLLesson 1: Introduction to HTML
Lesson 1: Introduction to HTML
Olivia Moran
 

What's hot (20)

Dhtml ppt (2)
Dhtml ppt (2)Dhtml ppt (2)
Dhtml ppt (2)
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Hushang Gaikwad
Hushang GaikwadHushang Gaikwad
Hushang Gaikwad
 
DHTML
DHTMLDHTML
DHTML
 
Css presentation lecture 1
Css presentation lecture 1Css presentation lecture 1
Css presentation lecture 1
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Introduction to html course digital markerters
Introduction to html course digital markertersIntroduction to html course digital markerters
Introduction to html course digital markerters
 
Html and css presentation
Html and css presentationHtml and css presentation
Html and css presentation
 
CSS
CSSCSS
CSS
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
WEB DEVELOPMENT
WEB DEVELOPMENTWEB DEVELOPMENT
WEB DEVELOPMENT
 
Unit 2 dhtml
Unit 2 dhtmlUnit 2 dhtml
Unit 2 dhtml
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Dhtml
DhtmlDhtml
Dhtml
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
Lesson 1: Introduction to HTML
Lesson 1: Introduction to HTMLLesson 1: Introduction to HTML
Lesson 1: Introduction to HTML
 
HTML 5
HTML 5HTML 5
HTML 5
 
Dhtml
DhtmlDhtml
Dhtml
 

Viewers also liked

Капремонт домов в Лакинске
Капремонт домов в ЛакинскеКапремонт домов в Лакинске
Капремонт домов в Лакинске
Otpravitel
 
Boulder County Real Estate Statistics March 2015
Boulder County Real Estate Statistics March 2015Boulder County Real Estate Statistics March 2015
Boulder County Real Estate Statistics March 2015
Neil Kearney
 
Boulder County Real Estate Statistics June 2015
Boulder County Real Estate Statistics June 2015Boulder County Real Estate Statistics June 2015
Boulder County Real Estate Statistics June 2015
Neil Kearney
 
Boulder Real Estate Statistics November 2014
Boulder Real Estate Statistics November 2014Boulder Real Estate Statistics November 2014
Boulder Real Estate Statistics November 2014
Neil Kearney
 
Language of the Month Jamaice
Language of the Month JamaiceLanguage of the Month Jamaice
Language of the Month Jamaicebaring
 
Boulder County Real Estate April 2015 Statistics
Boulder County Real Estate April 2015 StatisticsBoulder County Real Estate April 2015 Statistics
Boulder County Real Estate April 2015 Statistics
Neil Kearney
 
Boulder County Real Estate Statistics May 2015
Boulder County Real Estate Statistics May 2015Boulder County Real Estate Statistics May 2015
Boulder County Real Estate Statistics May 2015
Neil Kearney
 

Viewers also liked (8)

Капремонт домов в Лакинске
Капремонт домов в ЛакинскеКапремонт домов в Лакинске
Капремонт домов в Лакинске
 
Boulder County Real Estate Statistics March 2015
Boulder County Real Estate Statistics March 2015Boulder County Real Estate Statistics March 2015
Boulder County Real Estate Statistics March 2015
 
Boulder County Real Estate Statistics June 2015
Boulder County Real Estate Statistics June 2015Boulder County Real Estate Statistics June 2015
Boulder County Real Estate Statistics June 2015
 
Boulder Real Estate Statistics November 2014
Boulder Real Estate Statistics November 2014Boulder Real Estate Statistics November 2014
Boulder Real Estate Statistics November 2014
 
Language of the Month Jamaice
Language of the Month JamaiceLanguage of the Month Jamaice
Language of the Month Jamaice
 
Boulder County Real Estate April 2015 Statistics
Boulder County Real Estate April 2015 StatisticsBoulder County Real Estate April 2015 Statistics
Boulder County Real Estate April 2015 Statistics
 
Boulder County Real Estate Statistics May 2015
Boulder County Real Estate Statistics May 2015Boulder County Real Estate Statistics May 2015
Boulder County Real Estate Statistics May 2015
 
Prezentatsia dlya investorov (1)
Prezentatsia dlya investorov (1)Prezentatsia dlya investorov (1)
Prezentatsia dlya investorov (1)
 

Similar to Shyam sunder Rajasthan Computer

Introduction to css
Introduction to cssIntroduction to css
Introduction to css
Evolution Network
 
Css Founder.com | Cssfounder org
Css Founder.com | Cssfounder orgCss Founder.com | Cssfounder org
Css Founder.com | Cssfounder org
Css Founder
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
GmachImen
 
Css introduction
Css introductionCss introduction
Css introductionSridhar P
 
Lecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationLecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType Classification
ZahouAmel1
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
fantasticdigitaltools
 
CLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMINGCLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMING
Prof Ansari
 
Css
CssCss
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
elayelily
 
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
 
Tm 1st quarter - 3rd meeting
Tm   1st quarter - 3rd meetingTm   1st quarter - 3rd meeting
Tm 1st quarter - 3rd meeting
Esmeraldo Jr Guimbarda
 
chitra
chitrachitra
chitra
sweet chitra
 
Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8
RohanMistry15
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
nikhilsh66131
 
WELCOME-FOLKS--CSS.-AND-HTMLS.pptx
WELCOME-FOLKS--CSS.-AND-HTMLS.pptxWELCOME-FOLKS--CSS.-AND-HTMLS.pptx
WELCOME-FOLKS--CSS.-AND-HTMLS.pptx
HeroVins
 

Similar to Shyam sunder Rajasthan Computer (20)

Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Css Founder.com | Cssfounder org
Css Founder.com | Cssfounder orgCss Founder.com | Cssfounder org
Css Founder.com | Cssfounder org
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
 
Css introduction
Css introductionCss introduction
Css introduction
 
Lecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationLecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType Classification
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
CLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMINGCLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMING
 
Css
CssCss
Css
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
 
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
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Tm 1st quarter - 3rd meeting
Tm   1st quarter - 3rd meetingTm   1st quarter - 3rd meeting
Tm 1st quarter - 3rd meeting
 
chitra
chitrachitra
chitra
 
Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8
 
Unit 2.1
Unit 2.1Unit 2.1
Unit 2.1
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Css - Tutorial
Css - TutorialCss - Tutorial
Css - Tutorial
 
WELCOME-FOLKS--CSS.-AND-HTMLS.pptx
WELCOME-FOLKS--CSS.-AND-HTMLS.pptxWELCOME-FOLKS--CSS.-AND-HTMLS.pptx
WELCOME-FOLKS--CSS.-AND-HTMLS.pptx
 

Recently uploaded

Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 

Recently uploaded (20)

Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 

Shyam sunder Rajasthan Computer

  • 1. Introduction To CSS by: Alexandra Vlachakis Sandy Creek High School, Fayette County Schools Content and Resources Used With Permission: Interact With Web Standards. Copyright 2010. Erin Anderson et. Al. W3 Schools. www.w3schools.com. 12-25-11.
  • 2. HTML Review ► What is HTML used for? ► Give some examples of formatting tags in HTML? ► HTML is the most widely used language on the Web ► In today’s lesson we will be discussing the second most widely used language on the web ► Does anyone know the name of the second most widely used language?
  • 3. Lesson 1: History of CSS ► CSS was proposed in 1994 as a web styling language. To helps solve some of the problems HTML 4. ► There were other styling languages proposed at this time, such as Style Sheets for HTML and JSSS but CSS won. ► CSS2 became the recommendation in 1998 by W3C ► CSS3 was started in 1998 but it has never been completed. Some parts are still being developed and some components work on some browsers.
  • 4. Lesson 1: What is CSS? • CSS stands for Cascading Style Sheets • Styles - define how to display HTML elements • Styles are normally stored in Style Sheets Definition: Cascading Style Sheets (CSS) – is a rule based language that applies styling to your HTML elements. You write CSS rules in elements, and modify properties of those elements such as color, background color, width, border thickness, font size, etc.
  • 5. Lesson 1: Examples of CSS ► ► ► ► ► ► ► ► ► ► Example 1: http://www.csszengarden.com/ Example 2: http://w3schools.com/css/demo_default.htm If you notice each time we click on a different CSS style sheet on the two pages above the look and feel of each page changes dramatically but the content stays the same. HTML did not offer us this option. HTML was never intended to contain tags for formatting a document. HTML was intended to define the content of a document, like: <h1>This is a heading</h1> <p>This is a paragraph.</p> When tags like <font>, and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers. Development of large web sites, where fonts and color information were added to every single page, became a long and expensive process. To solve this problem, the World Wide Web Consortium (W3C) created CSS.
  • 6. HTML Formatting Review ► What are the starting tags in HTML? ► What are the ending tags in HTML? ► How do you save in a Notepad document so it becomes a web page? ► What is the tag for creating paragraphs in HTML? ► What is the tag for creating heading tags in HTML? ► What are the tags we use to format font: family, color,  size, alignment in HTML?
  • 7. Lesson 2: Syntax oF CSS  The CSS syntax is made up of 5 parts:      selector property/value declaration declaration block curly braces We will explore each part in the next slides.
  • 8. Selector  Definition: identifies the HTML elements that the rule will be applied to, identified by the actual element name, e.g. <body>, or by other means such as class attribute values.  Example: *The selector is normally the HTML element you want to style
  • 9. Property & Value  Definition: The property is the style attribute you want to change. Each property has a value. *Properties are separated from their respective values by colons : *Pairs are separated from each other by semicolons ;
  • 10. Declaration  Definition: Each CSS line that includes property and value *Each declaration consists of a property and a value.
  • 11. Declaration Block Definition: multiple declaration lines including the curly braces
  • 12. Curly Braces  Definition: the curly braces contain the properties of the element you want to manipulate, and the values that you want to change them to. The curly braces plus their content is called a declaration block.  Example:
  • 13. Lesson 2 Assignment: Let’s Create Our First CSS Page ► ► Open Notepad Type the following Code <html> <head> <style type="text/css"> p {color:red; text-align:center;} </style> </head> <body> <p>Hello World!</p> <p>This paragraph is styled with CSS.</p> </body> </html> ► ►Instructor Note: You can demonstrate how to do this by using the example given on the W3schools site. Also as you are creating this file point out to students where they will find the different syntax found in CSS. ►After creating the file have students manipulate the color and alignment values. Save Your File as css-myfirstpage.html into a new folder called CSS
  • 14.  Lesson 3: Class and id Selectors In addition to setting a style for a HTML element, CSS allows you to specify your own selectors called "id" and "class". id - The id selector is used to specify a style for a single, unique element.  The id selector uses the id attribute of the HTML element, and is defined with a "#".  The style rule below will be applied to the element with id="para1":  #para1 {text-align:center;color:red;}
  • 15. Lesson 3: Class and id Selectors Class - The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.  This allows you to set a particular style for any HTML elements with the same class.  The class selector uses the HTML class attribute, and is defined with a "."  In the example below, all HTML elements with class="center" will be center-aligned:  .center {text-align:center;}
  • 16.  Lesson 3: Class and id Selectors In the image below what is the h1 selector an ID or a Class? # .
  • 17. Lesson 3 Assignment: Let’s Create A CSS Page that uses “id” Open Notepad ► Type the following Code ► <html> <head> <style type="text/css"> #para1 { text-align:center; color:red; } </style> </head> ►Instructor Note: You can demonstrate how to do this by using the example given on the W3schools site. Also as you are creating this file point out to students where they will find the different syntax found in CSS ►After creating the file have students manipulate the name of the “id” <body> <p id="para1">Hello World!</p> <p>This paragraph is not affected by the style.</p> </body> </html> ► Save Your File as css-id.html into a your folder called CSS.
  • 18. Lesson 3 Assignment: Let’s Create A CSS Page that uses “class” Open Notepad ► Type the following Code ► <html> <head> <style type="text/css"> .center { text-align:center; } </style> </head> ►Instructor Note: You can demonstrate how to do this by using the example given on the W3schools site. Also as you are creating this file point out to students where they will find the different syntax found in CSS ►After creating the file have students manipulate the name of the “class” <body> <h1 class="center">Center-aligned heading</h1> <p class="center">Center-aligned paragraph.</p> </body> </html> ► Save Your File as css-class.html into a your folder called CSS.
  • 19. Lesson 3 Comments ► Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers. You add comments by enclosing them in /* and */ ► ► Comments can span several lines, and the browser will ignore these lines. ► Example: /* This is a basic comment it will not appear on the page*/     /* starts the comment */ is the end of the comment ► /*This is a comment*/ p{ text-align:center; color:black; font-family:arial;}
  • 20. Lesson 3 Assignment: Let’s Add A Comment ► ► Open Your CSS-ID example in Notepad Type the following Code right above the style you had written previously. <html> <head> /*This is an example of how to use ID in a CSS web page*/ <style type="text/css"> #para1 { text-align:center; color:red; } </style> </head> <body> <p id="para1">Hello World!</p> <p>This paragraph is not affected by the style.</p> </body> </html> ► Save Your File as css-comment.html into a your folder called CSS.
  • 21. Page Lesson 4: How CSS is Applied to A Web ► CSS is applied to a web page using three different methods:    Inline style Internal style sheet External style sheet
  • 22. Lesson 4: How CSS is Applied to A Web Page ► Inline CSS ► Applies styles directly to the elements by adding declarations into the style ► For Example: <p style=“color: red;”> This is a simple paragraph and the inline style makes it red.</p>
  • 23. Lesson 4: How CSS is Applied to A Web Page Internal Style Sheet ► Applies styles to HTML by placing the CSS rules inside the tag <style> inside the document tag <head>. ► For Example: <head> <title>my page</title> <style type=“text/css”> p{color:red}</style> </head> <body> <p>this is a simple paragraph </p> </body> ►
  • 24. Lesson 4: How CSS is Applied to A Web Page External CSS ► Applies styles as a separate file with a .css extension. The file is then referenced from inside the <head> element by a link to the file. ► For Example: <head> <title>my external style sheet page</title> <link rel=“style sheet” type=“text/css” href=“my-externalstylesheet.css”> <body> <p>this is a simple paragraph</p> </body> ► You can create an external style sheet in your text editor. ►
  • 25. Lesson 4: How CSS is Applied to A Web Page What style sheet is best? ► Web developers rarely use inline CSS. Since they prefer to not mix content with presentation. And it is not efficient since you have to declare the style individually for every component. ► ► Internal and External style sheets are more popular because you can style multiple elements with one rule. ► External style sheets are best because they allow you to save all the style information on a separate file from the content. You can then modify a style for a site and it will update all of the pages in a site.
  • 26. Lesson 5: Colors and Formatting in CSS ► CSS Colors ► In the previous lesson you have seen a few CSS styles that included color like: <p style=“color: red;”> ► There are a few ways that you can set colors in CSS: Keywords, Hex values, RGB, HSL(a)
  • 27. Lesson 5: Colors and Formatting in CSS ► CSS Colors: Keywords ► Using the keywords like: red, fuchsia, yellow, blue, green you can specify what color you would like the CSS rule to display. ► For example: ► p{color:red} ► h2{color:yellow} ► There are 17 of these keyword colors you can use in CSS.
  • 28. Lesson 5: Colors and Formatting in CSS Keyword Color Hex aqua #00ffff black #000000 blue #0000ff fuchsia #ff00ff gray #808080 green #008000 lime #00ff00 maroon #800000 navy #000080 olive #808000 orange (added in CSS 2.1) #ffa500 purple #800080 red #ff0000 silver #c0c0c0 teal #008080 white #ffffff yellow #ffff00
  • 29. Lesson 5: Colors and Formatting in CSS ► Computers are capable of displaying a lot more than 17 colors. ► In fact they can display approximately 16.7 million colors! ► Hex Values (hex is short for hexadecimal) are the most common way of specifying colors for web pages. (see hex# in the previous chart) ► For example: p{color: #000000;} /*This is equivalent to the keyword black*/
  • 30. Lesson 5: Colors and Formatting in CSS ► Hex numbers - has 16 possible values ► 0 to 9 then A to F. Which gives you 16 values. ► RGB (Red Green Blue) has the possibility of 256 colors for each (16x16) ► (R)256 x (G)256 x (B)256 = 16,777,216 or 16.7 million color values ► CSS example: h1{color: #000000;}
  • 31. Lesson 5: Colors and Formatting in CSS ► RGB (a) can also help specify colors in CSS RGB stands for Red Green Blue ► You can specify RGB in either whole numbers or percentages ► CSS example: h1{color: rgb(0,0,0) } /*this color is equivalent to #000000 or black */ ► You use numbers from 0 to 255 which covers the 256 color range. ► More examples can be found at: http://www.w3schools.com/css/css_colors.asp
  • 32. Lesson 5: Colors and Formatting in CSS RGB (a) can also help specify colors in CSS RGB stands for Red Green Blue. The “a” stands for alpha but we will learn about that in another lesson. ► You can specify RGB in either whole numbers or percentages ► CSS example: h1{color: rgb(0,0,0) } /*this color is equivalent to #000000 or black */ ► You use numbers from 0 to 255 which covers the 256 color range. ► More examples can be found at: http://www.w3schools.com/css/css_colors.asp ►
  • 33. Lesson 5: Colors and Formatting in CSS ► HSL (a) - Hue Saturation Lightness ► Similar to RGB but based on saturation and lightness of a color ► The “a” stands for alpha but we will learn about that in another lesson. ► CSS example: h1{color: hsl(0,100%,40%) } ► HSL accepts a number between 0 to 360 in value ► HSL also accepts percentage between 0-100%
  • 34. Lesson 5 Assignment: CSS Using Color ► ► Open Your CSS-ID example in Notepad Type the following Code right above the style you had written previously. <html> <body> <p style="background-color:#FFF111"> Color set by using hex value </p> <p style="background-color:rgb(0,255,0);"> Color set by using rgb value </p> <p style="background-color:red"> Color set by using color name </p> ►Instructor Note: You can demonstrate how to do this by using the example given on the W3schools site. Also as you are creating this file point out to students the different syntax found in CSS. ►After creating the file have students manipulate the color values to discover other color combinations. </body> </html> ► Save Your File as css-color.html into your folder called CSS