SlideShare a Scribd company logo
Oriented by: Vibol YOEUNG 
Tell: 077 377 067 
Yoeung.vibol@gmail.com
Import style sheet 
• In style sheet, we can import other style 
sheet by use 
• @import “style.css”;
CSS Selectors 
Use CSS Selectors to define properties for the 
structure and presentation of your site. 
This is the key to defining specific properties for 
specific parts of your design. 
Tag, Class, ID, Compound
CSS Selectors 
Tag: properties defined for an HTML tag. 
Class: properties defined for an HTML tag 
using a class or a <span> tag. 
ID: properties defined for an element or div 
using an id. 
Compound: properties defined using multiple 
selector types.
CSS Selectors 
Declaration 
body {margin: 10px 0;} 
Selector Property Value
CSS Selectors 
Tag*: properties defined for an HTML tag. 
(*Also referred to as Type, Element) 
body {margin: 10px 0;}
CSS Selectors 
Tag 
body {margin: 10px 0;} 
<body> 
Everything within the body will start out 
with this property. 
</body>
CSS Selectors 
Class: properties defined for an HTML tag 
using a class or a <span> tag. 
.red {margin: 15px; color: red;}
CSS Selectors 
Class 
.red {margin: 15px; color: red;} 
<p class=”red”>This is a paragraph of text 
in red.</p> 
These are <span class=”red”>words in 
red.</span>
CSS Selectors 
ID: properties defined for an element or div 
using an id. 
#wrapper {margin :0 auto;}
CSS Selectors 
ID 
#wrapper {margin :0 auto;} 
<div id=”wrapper”></div>
CSS Selectors 
Compound: properties defined using multiple 
selector types. 
#content p {margin :0;}
CSS Selectors 
Compound 
#content p {margin :0;} 
<div id=”content”> 
<p>This is a paragraph of text in the 
content div.</p> 
</div>
CSS Box Model 
How do you position content? 
You position content in your page by 
using a combination of margins, padding 
and floats. 
But, in order to get your positioning and 
layout correct, you must know how the 
CSS Box Model works.
CSS Box Model 
content
CSS Box Model 
10 px 
40 px 
100 px 
content 
450 px
CSS Box Model 
1 px 
10 px 
50 px 
content 
??? px 
500 px
CSS Box Model 
total box width = 
content area width + 
left padding + right padding + 
left border + right border + 
left margin + right margin
CSS Box Model 
What is the total box width? 
#content {width: 
200px;border: 1px solid 
#900;padding: 10px;margin: 
0;background: #fee;}
CSS Box Model 
If the total box width is 400px, what is the width 
of the content area? 
#content {width: 
???px;border: 1px solid 
#000;padding: 20px;margin: 
10;}
Pseudo-Selectors 
• •General Purpose Pseudo-Selector: 
• –:hover Element with mouse over 
• Specific to hyperlinks (and/or buttons) 
• –a:active A link or button that is currently 
being clicked on. 
• –a:link A link that has NOT been visited yet. 
• –a:visited A link that HAS been visited.
Background Image Properties 
• background-image: 
url(../location/of/image.jpg) 
• •background-repeat:tile image in 
background 
• •background-position:vertical(top, center, 
bottom, or size) horizontal(left, center, right, 
or size) 
• •background-attachment: (scrollor fixed)
Text Properties 
• text-indent:indents first line of a paragraph 
according to size 
• text-align:right;or left;or center;or justify; 
• text-decoration: none; orunderline; 
• text-transform:Capitalize; 
• Line-height:added vertical space to each 
line of text according to size
Text shadows 
• h3 {text-shadow: 1px 1px 2px #00} 
• x (horizontal) offset casts shadow to the right 
of the text. Negative cast to the left. 
• y (vertical) offset casts shadow below the 
text. Negative value casts above 
• Blue radius: blurs the shadow, with higher 
values making the shadow wider or lighter. 
• Color: make color for shadow text
Attribute selector 
- CSS [attribute]: use to select element with specified 
attribute 
Ex. a[target] {color: red} 
- CSS [attribute=value]: use to select element with 
specified attribute and value 
Ex. Input[type=“submit”] {color: #fff}
Attribute selector(con) 
- CSS [attribute~=value]: use to select element with 
an attribute with containing a specified word 
- Ex. [title~=“shop”] {color: #000} 
- CSS [attribute|=value]: select elements with the 
specified attribute starting with the specified value. 
- Ex. [class|=“top”] {background: blue}
Attribute selector(con) 
- CSS [attribute^=value]: used to select elements 
whose attribute value begins with a specified 
value 
Ex. [class^=“top”] {background: blue} 
- CSS [attribute$=value]: used to select elements 
whose attribute value ends with a specified value. 
Ex. [class$=“top”] {background: blue}
List Properties <ul> 
• list-style-type:none, disc, circle, 
square,(other types available) 
• list-style-position: inside oroutside 
• list-style-image:url(../path/to/image.jpg) 
• …or shorthand 
• list-style:type position image
Position 
• Static position: is a default position and 
element is always positioned according to 
the normal flow of the page.
Position fixed 
• An element with fixed position is positioned 
relative the browser window. It will not move 
even if window is scrolled:
Position fixed(con) 
• Ex. 
• .box { 
position: fixed; 
width: 400px; 
height: 400px; 
}
Position relative 
• element is positioned relative to its normal 
position. 
• Ex. Box2 { 
position: relative; 
left: -10px; 
}
Position absolute 
• An absolute position element is positioned 
relative to the first parent element that has a 
position other than static. 
• Ex. Box2 { 
position: absolute; 
left: 10px; 
top: 20px; 
}
Z-index 
• property specifies the stack order of an 
element (which element should be placed in 
front of, or behind, the others). 
• Ex. .box2 { 
z-index: 1; 
Position: absolute; 
}

More Related Content

PPT
PPTX
CSS Walktrough Internship Course
PPTX
Cascading style sheets - CSS
PPTX
Css2layout
PDF
Introduction 2 css
PPTX
css v1 guru
PDF
Basic-CSS-tutorial
PPTX
1 03 - CSS Introduction
CSS Walktrough Internship Course
Cascading style sheets - CSS
Css2layout
Introduction 2 css
css v1 guru
Basic-CSS-tutorial
1 03 - CSS Introduction

What's hot (20)

PPT
Introduction to CSS
PDF
CSS and Layout
PPTX
KEY
CSS and CSS3
PDF
CSS: a rapidly changing world
PPTX
Cascading style sheet part 2
PPTX
FFW Gabrovo PMG - HTML
PDF
2 introduction css
KEY
Style With Kyle - Kyle Smith
PPTX
Css3 Presetation
PPTX
New Elements & Features in CSS3
PDF
PPTX
PDF
[Worskhop Summits] CSS3 Workshop
PPTX
FFW Gabrovo PMG - CSS
PDF
Fundamental CSS3
PPT
CSS Part I
PPTX
Cascading Style Sheet (CSS)
KEY
Wrangling the CSS Beast with Sass
Introduction to CSS
CSS and Layout
CSS and CSS3
CSS: a rapidly changing world
Cascading style sheet part 2
FFW Gabrovo PMG - HTML
2 introduction css
Style With Kyle - Kyle Smith
Css3 Presetation
New Elements & Features in CSS3
[Worskhop Summits] CSS3 Workshop
FFW Gabrovo PMG - CSS
Fundamental CSS3
CSS Part I
Cascading Style Sheet (CSS)
Wrangling the CSS Beast with Sass
Ad

Viewers also liked (14)

PPT
HTML basic
PPTX
Shapes
PDF
Javascript DOM
PPTX
Laporan KKA Mahasiswa UMK
DOC
Dhanashri Deshmukh Resume
PPTX
shapes
PDF
Introduction to mongodb
ODP
PHP Basic
PPTX
Domino & REST
PPT
PPTX
Penggunaan Kalkulator Saintifik -Taburan normal
PPTX
Penggunaan Kalkulator Saintifik - Taburan normal
PPTX
Penggunaan Kalkulator - Persamaan kuadratik
PPTX
Penggunaan Kalkulator Saintifik - Persamaan serentak
HTML basic
Shapes
Javascript DOM
Laporan KKA Mahasiswa UMK
Dhanashri Deshmukh Resume
shapes
Introduction to mongodb
PHP Basic
Domino & REST
Penggunaan Kalkulator Saintifik -Taburan normal
Penggunaan Kalkulator Saintifik - Taburan normal
Penggunaan Kalkulator - Persamaan kuadratik
Penggunaan Kalkulator Saintifik - Persamaan serentak
Ad

Similar to CSS for basic learner (20)

PPTX
Casecading Style Sheets for Hyper Text Transfer Protocol.pptx
PPT
Basic css
PPT
Tutorial0eesrtjfzjgxkgxkxxkxkgxkgxjffj3.ppt
PPTX
Web 102 INtro to CSS
PPTX
PPTX
CSS Cascade Style Sheet
PPTX
Lecture 6.pptx..........................
PDF
Web Programming& Scripting Lab
PPTX
CSS Basics part One
PPTX
CSS tutorial chapter 1
PPTX
PPTX
WT CSS
PPTX
v5-introduction to html-css-210321161444.pptx
PPTX
v5-introduction to html-css-210321161444.pptx
PPTX
Unit - 3 CSS(Cascading Style Sheet).pptx
PPT
CSS Basics
PPTX
PPTX
CSS Topic wise Short notes ppt by Navya.E
PDF
CSS Foundations, pt 2
PPTX
Web topic 15 1 basic css layout
Casecading Style Sheets for Hyper Text Transfer Protocol.pptx
Basic css
Tutorial0eesrtjfzjgxkgxkxxkxkgxkgxjffj3.ppt
Web 102 INtro to CSS
CSS Cascade Style Sheet
Lecture 6.pptx..........................
Web Programming& Scripting Lab
CSS Basics part One
CSS tutorial chapter 1
WT CSS
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
Unit - 3 CSS(Cascading Style Sheet).pptx
CSS Basics
CSS Topic wise Short notes ppt by Navya.E
CSS Foundations, pt 2
Web topic 15 1 basic css layout

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MYSQL Presentation for SQL database connectivity
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Encapsulation theory and applications.pdf
A Presentation on Artificial Intelligence
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Network Security Unit 5.pdf for BCA BBA.
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Dropbox Q2 2025 Financial Results & Investor Presentation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology

CSS for basic learner

  • 1. Oriented by: Vibol YOEUNG Tell: 077 377 067 [email protected]
  • 2. Import style sheet • In style sheet, we can import other style sheet by use • @import “style.css”;
  • 3. CSS Selectors Use CSS Selectors to define properties for the structure and presentation of your site. This is the key to defining specific properties for specific parts of your design. Tag, Class, ID, Compound
  • 4. CSS Selectors Tag: properties defined for an HTML tag. Class: properties defined for an HTML tag using a class or a <span> tag. ID: properties defined for an element or div using an id. Compound: properties defined using multiple selector types.
  • 5. CSS Selectors Declaration body {margin: 10px 0;} Selector Property Value
  • 6. CSS Selectors Tag*: properties defined for an HTML tag. (*Also referred to as Type, Element) body {margin: 10px 0;}
  • 7. CSS Selectors Tag body {margin: 10px 0;} <body> Everything within the body will start out with this property. </body>
  • 8. CSS Selectors Class: properties defined for an HTML tag using a class or a <span> tag. .red {margin: 15px; color: red;}
  • 9. CSS Selectors Class .red {margin: 15px; color: red;} <p class=”red”>This is a paragraph of text in red.</p> These are <span class=”red”>words in red.</span>
  • 10. CSS Selectors ID: properties defined for an element or div using an id. #wrapper {margin :0 auto;}
  • 11. CSS Selectors ID #wrapper {margin :0 auto;} <div id=”wrapper”></div>
  • 12. CSS Selectors Compound: properties defined using multiple selector types. #content p {margin :0;}
  • 13. CSS Selectors Compound #content p {margin :0;} <div id=”content”> <p>This is a paragraph of text in the content div.</p> </div>
  • 14. CSS Box Model How do you position content? You position content in your page by using a combination of margins, padding and floats. But, in order to get your positioning and layout correct, you must know how the CSS Box Model works.
  • 15. CSS Box Model content
  • 16. CSS Box Model 10 px 40 px 100 px content 450 px
  • 17. CSS Box Model 1 px 10 px 50 px content ??? px 500 px
  • 18. CSS Box Model total box width = content area width + left padding + right padding + left border + right border + left margin + right margin
  • 19. CSS Box Model What is the total box width? #content {width: 200px;border: 1px solid #900;padding: 10px;margin: 0;background: #fee;}
  • 20. CSS Box Model If the total box width is 400px, what is the width of the content area? #content {width: ???px;border: 1px solid #000;padding: 20px;margin: 10;}
  • 21. Pseudo-Selectors • •General Purpose Pseudo-Selector: • –:hover Element with mouse over • Specific to hyperlinks (and/or buttons) • –a:active A link or button that is currently being clicked on. • –a:link A link that has NOT been visited yet. • –a:visited A link that HAS been visited.
  • 22. Background Image Properties • background-image: url(../location/of/image.jpg) • •background-repeat:tile image in background • •background-position:vertical(top, center, bottom, or size) horizontal(left, center, right, or size) • •background-attachment: (scrollor fixed)
  • 23. Text Properties • text-indent:indents first line of a paragraph according to size • text-align:right;or left;or center;or justify; • text-decoration: none; orunderline; • text-transform:Capitalize; • Line-height:added vertical space to each line of text according to size
  • 24. Text shadows • h3 {text-shadow: 1px 1px 2px #00} • x (horizontal) offset casts shadow to the right of the text. Negative cast to the left. • y (vertical) offset casts shadow below the text. Negative value casts above • Blue radius: blurs the shadow, with higher values making the shadow wider or lighter. • Color: make color for shadow text
  • 25. Attribute selector - CSS [attribute]: use to select element with specified attribute Ex. a[target] {color: red} - CSS [attribute=value]: use to select element with specified attribute and value Ex. Input[type=“submit”] {color: #fff}
  • 26. Attribute selector(con) - CSS [attribute~=value]: use to select element with an attribute with containing a specified word - Ex. [title~=“shop”] {color: #000} - CSS [attribute|=value]: select elements with the specified attribute starting with the specified value. - Ex. [class|=“top”] {background: blue}
  • 27. Attribute selector(con) - CSS [attribute^=value]: used to select elements whose attribute value begins with a specified value Ex. [class^=“top”] {background: blue} - CSS [attribute$=value]: used to select elements whose attribute value ends with a specified value. Ex. [class$=“top”] {background: blue}
  • 28. List Properties <ul> • list-style-type:none, disc, circle, square,(other types available) • list-style-position: inside oroutside • list-style-image:url(../path/to/image.jpg) • …or shorthand • list-style:type position image
  • 29. Position • Static position: is a default position and element is always positioned according to the normal flow of the page.
  • 30. Position fixed • An element with fixed position is positioned relative the browser window. It will not move even if window is scrolled:
  • 31. Position fixed(con) • Ex. • .box { position: fixed; width: 400px; height: 400px; }
  • 32. Position relative • element is positioned relative to its normal position. • Ex. Box2 { position: relative; left: -10px; }
  • 33. Position absolute • An absolute position element is positioned relative to the first parent element that has a position other than static. • Ex. Box2 { position: absolute; left: 10px; top: 20px; }
  • 34. Z-index • property specifies the stack order of an element (which element should be placed in front of, or behind, the others). • Ex. .box2 { z-index: 1; Position: absolute; }

Editor's Notes

  • #27: | Note: The value has to be a whole word, either alone, like class="top", or followed by a hyphen( - ), like class="top-text"! <h1 class="top-header">Welcome</h1> <p class="top-text">Hello world!</p> <p class="topcontent">Are you learning CSS?</p>