SlideShare ist ein Scribd-Unternehmen logo
1 von 34
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; 
}

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
CSS and Layout
CSS and LayoutCSS and Layout
CSS and Layout
 
Css3
Css3Css3
Css3
 
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
Cascading style sheet part 2
Cascading style sheet   part 2Cascading style sheet   part 2
Cascading style sheet part 2
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
 
Style With Kyle - Kyle Smith
Style With Kyle - Kyle SmithStyle With Kyle - Kyle Smith
Style With Kyle - Kyle Smith
 
Css3 Presetation
Css3 PresetationCss3 Presetation
Css3 Presetation
 
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3
 
Sass
SassSass
Sass
 
CSS
CSSCSS
CSS
 
Css3
Css3Css3
Css3
 
[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop
 
FFW Gabrovo PMG - CSS
FFW Gabrovo PMG - CSSFFW Gabrovo PMG - CSS
FFW Gabrovo PMG - CSS
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
CSS Part I
CSS Part ICSS Part I
CSS Part I
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 

Andere mochten auch

Laporan KKA Mahasiswa UMK
Laporan KKA Mahasiswa UMKLaporan KKA Mahasiswa UMK
Laporan KKA Mahasiswa UMKLa hamu
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodbYoeung Vibol
 
Penggunaan Kalkulator Saintifik -Taburan normal
Penggunaan Kalkulator Saintifik -Taburan normalPenggunaan Kalkulator Saintifik -Taburan normal
Penggunaan Kalkulator Saintifik -Taburan normalamimuin
 
Penggunaan Kalkulator Saintifik - Taburan normal
Penggunaan Kalkulator Saintifik - Taburan normalPenggunaan Kalkulator Saintifik - Taburan normal
Penggunaan Kalkulator Saintifik - Taburan normalamimuin
 
Penggunaan Kalkulator - Persamaan kuadratik
Penggunaan Kalkulator - Persamaan kuadratikPenggunaan Kalkulator - Persamaan kuadratik
Penggunaan Kalkulator - Persamaan kuadratikamimuin
 
Penggunaan Kalkulator Saintifik - Persamaan serentak
Penggunaan Kalkulator Saintifik - Persamaan serentakPenggunaan Kalkulator Saintifik - Persamaan serentak
Penggunaan Kalkulator Saintifik - Persamaan serentakamimuin
 

Andere mochten auch (14)

HTML basic
HTML basicHTML basic
HTML basic
 
Shapes
ShapesShapes
Shapes
 
Javascript DOM
Javascript DOMJavascript DOM
Javascript DOM
 
Laporan KKA Mahasiswa UMK
Laporan KKA Mahasiswa UMKLaporan KKA Mahasiswa UMK
Laporan KKA Mahasiswa UMK
 
Dhanashri Deshmukh Resume
Dhanashri Deshmukh ResumeDhanashri Deshmukh Resume
Dhanashri Deshmukh Resume
 
shapes
shapesshapes
shapes
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
PHP Basic
PHP BasicPHP Basic
PHP Basic
 
Domino & REST
Domino & RESTDomino & REST
Domino & REST
 
Vip o santo
Vip o santoVip o santo
Vip o santo
 
Penggunaan Kalkulator Saintifik -Taburan normal
Penggunaan Kalkulator Saintifik -Taburan normalPenggunaan Kalkulator Saintifik -Taburan normal
Penggunaan Kalkulator Saintifik -Taburan normal
 
Penggunaan Kalkulator Saintifik - Taburan normal
Penggunaan Kalkulator Saintifik - Taburan normalPenggunaan Kalkulator Saintifik - Taburan normal
Penggunaan Kalkulator Saintifik - Taburan normal
 
Penggunaan Kalkulator - Persamaan kuadratik
Penggunaan Kalkulator - Persamaan kuadratikPenggunaan Kalkulator - Persamaan kuadratik
Penggunaan Kalkulator - Persamaan kuadratik
 
Penggunaan Kalkulator Saintifik - Persamaan serentak
Penggunaan Kalkulator Saintifik - Persamaan serentakPenggunaan Kalkulator Saintifik - Persamaan serentak
Penggunaan Kalkulator Saintifik - Persamaan serentak
 

Ähnlich wie CSS for basic learner

Ähnlich wie CSS for basic learner (20)

Basic css
Basic cssBasic css
Basic css
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
 
Css
CssCss
Css
 
CSS Cascade Style Sheet
CSS Cascade Style SheetCSS Cascade Style Sheet
CSS Cascade Style Sheet
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
 
html-css
html-csshtml-css
html-css
 
WT CSS
WT  CSSWT  CSS
WT CSS
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Css3
Css3Css3
Css3
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
 
Web topic 15 1 basic css layout
Web topic 15 1  basic css layoutWeb topic 15 1  basic css layout
Web topic 15 1 basic css layout
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
Web technology
Web technologyWeb technology
Web technology
 
Web - CSS 1.pptx
Web - CSS 1.pptxWeb - CSS 1.pptx
Web - CSS 1.pptx
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Journey To The Front End World - Part2 - The Cosmetic
Journey To The Front End World - Part2 - The  CosmeticJourney To The Front End World - Part2 - The  Cosmetic
Journey To The Front End World - Part2 - The Cosmetic
 
Web Development - Lecture 6
Web Development - Lecture 6Web Development - Lecture 6
Web Development - Lecture 6
 

Kürzlich hochgeladen

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

CSS for basic learner

  • 1. Oriented by: Vibol YOEUNG Tell: 077 377 067 Yoeung.vibol@gmail.com
  • 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; }

Hinweis der Redaktion

  1. | 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>