SlideShare ist ein Scribd-Unternehmen logo
1 von 50
CSS
CASCADING STYLE SHEET
CSS
 Two recommendations for CSS
 1.CSS Level 1[w3c CSS 1.0]
 2.CSS Level 2
 3.CSS Level 3[ 2D Transform,3D
Transform,Animation,User
Interface,Background etc]
CSS Selector
 CSS selectors are the heart and soul of CSS.
 In a typical CSS statement you have the
following:
 SELECTOR { PROPERTY: VALUE }
Types of CSS
 EXTERNAL CSS
 INTERNAL CSS
 INLINE CSS
CSS FILE
 CSS Code:
 body{ background-color: gray;}
 p { color: blue; }
 h3{ color: white; }
HTML FILE
 <html> <head>
 <link rel="stylesheet" type="text/css"
href="test.css" />
 </head>
 <body>
 <h3> A White Header </h3> <p> This
paragraph has a blue font. The background
color of this page is gray because we changed
it with CSS! </p> </body> </html>
Why Use External CSS?
 It keeps your website design and content
separate.
 It's much easier to reuse your CSS code if you
have it in a separate file. Instead of typing the
same CSS code on every web page you have,
simply have many pages refer to a single CSS
file with the "link" tag.
 You can make drastic changes to your web
pages with just a few changes in a single CSS
file.
INTERNAL STYLE SHEETS
 <html> <head>
 <style type="text/css">
 p {color: white; }
 body {background-color: black; }
 </style> </head>
 <body>
 <p>White text on a black background!</p>
 </body>
 </html>
Inline style sheets
 <html> <head>
 <title>welcome</title>
 <body>
 <p style="background: blue; color: white;">A
new background and font color with inline
CSS</p>
 </body>
 </html>
CSS Classes
 CSS Code:
 p.first{ color: blue; } p.second{ color: red; }
 HTML Code:
 <html> <body> <p>This is a normal
paragraph.</p>
<p class="first">This is a paragraph that uses
the p.first CSS code!</p> <p
class="second">This is a paragraph that uses
the p.second CSS code!</p> ...
Style Rule Cascading and
Inheritance
CSS Background
 CSS Background Color
 h4 { background-color: white; }
 p { background-color: #1078E1; }
 ul { background-color: rgb( 149, 206, 145); }
CSS Background Image
 p { background-image: url(smallPic.jpg); }
 h4{ background-image:
url(http://www.tizag.com/pics/cssT/smallPic.jpg
); }
Background Image Repeat
 You can have a background image repeat vertically (y-
axis), horizontally (x-axis), in both directions, or in
neither direction.
 CSS Code:
 p { background-image: url(smallPic.jpg);
 background-repeat: repeat; }
 h4 { background-image: url(smallPic.jpg); background-
repeat: repeat-y;}
 ol { background-image: url(smallPic.jpg); background-
repeat: repeat-x;}
 ul { background-image: url(smallPic.jpg); background-
repeat: no-repeat;}
CSS Background Image
Positioning
 p { background-image: url(smallPic.jpg);
background-position: 20px 10px; }
 h4 { background-image: url(smallPic.jpg);
background-position: 30% 30%; }
 ol { background-image: url(smallPic.jpg);
background-position: top center; }
CSS Field Background Image
 body.noScroll { background-image:
url(smallPic.jpg); background-attachment:
fixed; }
 body{ background-image: url(smallPic.jpg);
background-attachment: scroll;}
CSS Font
 Font –color
h4 { color: red; }
h5 { color: #9000A1; }
h6 { color: rgb(0, 220, 98); }
 css font family
h4 { font-family: sans-serif; }
h5 { font-family: serif; }
h6 { font-family: arial; }
 CSS Font size
p { font-size: 120%; }
ol{ font-size: 10px; }
ul{ font-size: x-large; }
 CSS Font Style
p { font-style: italic; }
h4{ font-style: oblique; }
CSS Font weight
p { font-weight: 100; }
ul{ font-weight: bolder; }
CSS TEXT
 Text Decoration
 h4{ text-decoration: line-through; } h5{ text-
decoration: overline; } h6{ text-decoration:
underline; } a { text-
 decoration: none; }
 Text Indent
 p { text-indent: 20px; }
 h5 { text-indent: 30%; }
 Text Align
 p { text-align: right; }
 h5{ text-align: justify; }
 Text Transform
 p { text-transform: capitalize; }
 h5{ text-transform: uppercase; }
 h6{ text-transform: lowercase; }
 CSS White Space
 p { white-space: nowrap; }
CSS Lists
 Lists come in two basic flavors: unordered and
ordered
 CSS Lists With Images
 ul { list-style-image: url("listArrow.gif"); } ol {
list-style-image: url("listArrow2.gif"); }
 CSS List Position
 ul { list-style-position: inside; }
 ol { list-style-position: outside; }
CSS Box Model
 All HTML elements can be considered as
boxes. In CSS, the term "box model" is used
when talking about design and layout.
 The CSS box model is essentially a box that
wraps around HTML elements, and it consists
of: margins, borders, padding, and the actual
content.
 The box model allows us to place a border
around elements and space elements in
relation to other elements.
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
 Every rendered element occupies a box:
(or inner edge)
(or outer edge)
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s
slides
CSS Box Model
 Margin - Clears an area around the border. The
margin does not have a background color, it is
completely transparent
 Border - A border that goes around the padding
and content. The border is inherited from the color
property of the box
 Padding - Clears an area around the content. The
padding is affected by the background color of the
box
 Content - The content of the box, where text and
images appear
example
 <!DOCTYPE html>
 <html><head>
 <style>
 div.ex {
 width: 220px;
 padding: 10px;
 border: 5px solid gray;
 margin: 0px;
 }
 </style>
 </head>
 <body>
<img src="w3css.gif" width="250" height="250">
 <div class="ex">The picture above is 250px wide. The total width of this element is also
250px.</div>
</body>
 </html>
 The total width of an element should be
calculated like this:
 Total element width = width + left padding +
right padding + left border + right border + left
margin + right margin
 The total height of an element should be
calculated like this:
 Total element height = height + top padding +
bottom padding + top border + bottom border
+ top margin + bottom margi
CSS Border
 <head>
 <style>
 p.none {border-style: none;}
 p.dotted {border-style: dotted;}
 p.dashed {border-style: dashed;}
 p.solid {border-style: solid;}
 p.double {border-style: double;}
 p.groove {border-style: groove;}
 p.ridge {border-style: ridge;}
 p.inset {border-style: inset;}
 p.outset {border-style: outset;}
 p.hidden {border-style: hidden;}
 </style>
 </head>
 <body>
 <p class="none">No border.</p>
 <p class="dotted">A dotted border.</p>
 <p class="dashed">A dashed border.</p>
 <p class="solid">A solid border.</p>
 <p class="double">A double border.</p>
 <p class="groove">A groove border.</p>
 <p class="ridge">A ridge border.</p>
 <p class="inset">An inset border.</p>
 <p class="outset">An outset border.</p>
 <p class="hidden">A hidden border.</p>
 </body>
 </html>
Result
Positioning
 There are four different positioning methods.
1. Static Positioning
2. Fixed Positioning
3. Relative Positioning
4. Absolute Positioning
Static Positioning
 HTML elements are positioned static by
default. A static positioned element is always
positioned according to the normal flow of the
page.
Fixed Positioning
 An element with fixed position is positioned
relative to the browser window
 p.pos_fixed {
position: fixed;
top: 30px;
right: 5px;
}
example
 <!DOCTYPE html>
 <html><head>
 <style>
 p.pos_fixed {
 position: fixed;
 top: 30px;
 right: 5px;
 color: red;
 }
 </style></head>
 <body><p><b>Note:</b> IE7 and IE8 supports the fixed value only if a !DOCTYPE
is specified.</p>
 <p>Some text</p>
 <p class="pos_fixed">Some positioned text.</p>
 </body>
 </html>
output
Relative Positioning
 A relative positioned element is positioned relative
to its normal position.
 Example
 h2.pos_left {
position: relative;
left: -20px;
}
h2.pos_right {
position: relative;
left: 20px;
}
example
 <!DOCTYPE html>
 <html><head><style>
 h2.pos_left {
 position: relative;
 left: -20px;}
h2.pos_right {
 position: relative;
 left: 20px;
 }</style></head>
 <body>
<h2>Heading with no position</h2>
<h2 class="pos_left">This heading is moved left according to its normal
position</h2>
 <h2 class="pos_right">This heading is moved right according to its normal
position</h2></body></html>
result
Absolute Positioning
 An absolute position element is positioned
relative to the first parent element that has a
position other than static. If no such element is
found, the containing block is <html>:
 Example
 h2 {
position: absolute;
left: 100px;
top: 150px;
}
Example
 <!DOCTYPE html>
 <html><head>
 <style>
 h2 {
 position: absolute;
 left: 100px;
 top: 150px;
 }</style>
 </head><body>
<h2>This heading has an absolute position</h2>
<p>With absolute positioning, an element can be placed anywhere on
a page. The heading below is placed 100px from the left of the page
and 150px from the top of the page.</p>
</body></html>
Result
CSS Cursor Icons
 default - Display the normal mouse cursor
icon
 wait - The mouse icon to represent the
computer "thinking"
 crosshair - A cross hair reticle
 text - An "I" shaped icon that is displayed
when selecting text
 pointer - A hand icon that you see when you
hover over an HTML link
 help - A question mark (usually)
CSS Cursor Code
 <html>
 <head>
 <style>
p { cursor: wait; }
h4 { cursor: help; }
 h5 { cursor: crosshair; }
</style>
 </head>
 <body>
 <h4>We Want to Help You!</h4>
 <p>This may take a while to load....so don't worry, be happy!</p>
 <h5>Do You Like To Play Shooting Games on the Computer?</h5>
 </body>
 </html>
CSS Guide: A Complete Reference to Cascading Style Sheets

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
 
What is HTML5?
What is HTML5?What is HTML5?
What is HTML5?
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Background property in css
Background property in cssBackground property in css
Background property in css
 
Css color and background properties
Css color and background propertiesCss color and background properties
Css color and background properties
 
Concept of CSS part 2
Concept of CSS part 2Concept of CSS part 2
Concept of CSS part 2
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
Modular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS WorkshopModular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS Workshop
 
Tables and forms with HTML, CSS
Tables and forms with HTML, CSS  Tables and forms with HTML, CSS
Tables and forms with HTML, CSS
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
 
Css Basics
Css BasicsCss Basics
Css Basics
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
CSS
CSSCSS
CSS
 
CSS Refresher
CSS RefresherCSS Refresher
CSS Refresher
 
An Intro to HTML & CSS
An Intro to HTML & CSSAn Intro to HTML & CSS
An Intro to HTML & CSS
 
Html intro
Html introHtml intro
Html intro
 
Css
CssCss
Css
 
Css
CssCss
Css
 

Ähnlich wie CSS Guide: A Complete Reference to Cascading Style Sheets

Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.netProgrammer Blog
 
Css tutorial
Css tutorialCss tutorial
Css tutorialvedaste
 
Web app development_html_css_03
Web app development_html_css_03Web app development_html_css_03
Web app development_html_css_03Hassen Poreya
 
Html5 elements-Kip Academy
Html5 elements-Kip AcademyHtml5 elements-Kip Academy
Html5 elements-Kip Academykip academy
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learnerYoeung Vibol
 
Cascading style sheet: complete explanation with some examples
Cascading style sheet: complete explanation with some examplesCascading style sheet: complete explanation with some examples
Cascading style sheet: complete explanation with some examplesyashodamb
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 
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 layoutCK Yang
 

Ähnlich wie CSS Guide: A Complete Reference to Cascading Style Sheets (20)

Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Ict 8 css
Ict 8 cssIct 8 css
Ict 8 css
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.net
 
WT CSS
WT  CSSWT  CSS
WT CSS
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 
html-css
html-csshtml-css
html-css
 
CSS
CSSCSS
CSS
 
Web app development_html_css_03
Web app development_html_css_03Web app development_html_css_03
Web app development_html_css_03
 
Css tips & tricks
Css tips & tricksCss tips & tricks
Css tips & tricks
 
CSS
CSSCSS
CSS
 
Html5 elements-Kip Academy
Html5 elements-Kip AcademyHtml5 elements-Kip Academy
Html5 elements-Kip Academy
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
 
Cascading style sheet: complete explanation with some examples
Cascading style sheet: complete explanation with some examplesCascading style sheet: complete explanation with some examples
Cascading style sheet: complete explanation with some examples
 
css-ppt.pdf
css-ppt.pdfcss-ppt.pdf
css-ppt.pdf
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
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
 

Kürzlich hochgeladen

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Kürzlich hochgeladen (20)

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

CSS Guide: A Complete Reference to Cascading Style Sheets

  • 2. CSS  Two recommendations for CSS  1.CSS Level 1[w3c CSS 1.0]  2.CSS Level 2  3.CSS Level 3[ 2D Transform,3D Transform,Animation,User Interface,Background etc]
  • 3. CSS Selector  CSS selectors are the heart and soul of CSS.  In a typical CSS statement you have the following:  SELECTOR { PROPERTY: VALUE }
  • 4. Types of CSS  EXTERNAL CSS  INTERNAL CSS  INLINE CSS
  • 5. CSS FILE  CSS Code:  body{ background-color: gray;}  p { color: blue; }  h3{ color: white; }
  • 6. HTML FILE  <html> <head>  <link rel="stylesheet" type="text/css" href="test.css" />  </head>  <body>  <h3> A White Header </h3> <p> This paragraph has a blue font. The background color of this page is gray because we changed it with CSS! </p> </body> </html>
  • 7. Why Use External CSS?  It keeps your website design and content separate.  It's much easier to reuse your CSS code if you have it in a separate file. Instead of typing the same CSS code on every web page you have, simply have many pages refer to a single CSS file with the "link" tag.  You can make drastic changes to your web pages with just a few changes in a single CSS file.
  • 8. INTERNAL STYLE SHEETS  <html> <head>  <style type="text/css">  p {color: white; }  body {background-color: black; }  </style> </head>  <body>  <p>White text on a black background!</p>  </body>  </html>
  • 9. Inline style sheets  <html> <head>  <title>welcome</title>  <body>  <p style="background: blue; color: white;">A new background and font color with inline CSS</p>  </body>  </html>
  • 10. CSS Classes  CSS Code:  p.first{ color: blue; } p.second{ color: red; }  HTML Code:  <html> <body> <p>This is a normal paragraph.</p> <p class="first">This is a paragraph that uses the p.first CSS code!</p> <p class="second">This is a paragraph that uses the p.second CSS code!</p> ...
  • 11. Style Rule Cascading and Inheritance CSS Background  CSS Background Color  h4 { background-color: white; }  p { background-color: #1078E1; }  ul { background-color: rgb( 149, 206, 145); }
  • 12. CSS Background Image  p { background-image: url(smallPic.jpg); }  h4{ background-image: url(http://www.tizag.com/pics/cssT/smallPic.jpg ); }
  • 13. Background Image Repeat  You can have a background image repeat vertically (y- axis), horizontally (x-axis), in both directions, or in neither direction.  CSS Code:  p { background-image: url(smallPic.jpg);  background-repeat: repeat; }  h4 { background-image: url(smallPic.jpg); background- repeat: repeat-y;}  ol { background-image: url(smallPic.jpg); background- repeat: repeat-x;}  ul { background-image: url(smallPic.jpg); background- repeat: no-repeat;}
  • 14. CSS Background Image Positioning  p { background-image: url(smallPic.jpg); background-position: 20px 10px; }  h4 { background-image: url(smallPic.jpg); background-position: 30% 30%; }  ol { background-image: url(smallPic.jpg); background-position: top center; }
  • 15. CSS Field Background Image  body.noScroll { background-image: url(smallPic.jpg); background-attachment: fixed; }  body{ background-image: url(smallPic.jpg); background-attachment: scroll;}
  • 16. CSS Font  Font –color h4 { color: red; } h5 { color: #9000A1; } h6 { color: rgb(0, 220, 98); }  css font family h4 { font-family: sans-serif; } h5 { font-family: serif; } h6 { font-family: arial; }  CSS Font size p { font-size: 120%; } ol{ font-size: 10px; } ul{ font-size: x-large; }
  • 17.  CSS Font Style p { font-style: italic; } h4{ font-style: oblique; } CSS Font weight p { font-weight: 100; } ul{ font-weight: bolder; }
  • 18. CSS TEXT  Text Decoration  h4{ text-decoration: line-through; } h5{ text- decoration: overline; } h6{ text-decoration: underline; } a { text-  decoration: none; }  Text Indent  p { text-indent: 20px; }  h5 { text-indent: 30%; }
  • 19.  Text Align  p { text-align: right; }  h5{ text-align: justify; }  Text Transform  p { text-transform: capitalize; }  h5{ text-transform: uppercase; }  h6{ text-transform: lowercase; }  CSS White Space  p { white-space: nowrap; }
  • 20. CSS Lists  Lists come in two basic flavors: unordered and ordered  CSS Lists With Images  ul { list-style-image: url("listArrow.gif"); } ol { list-style-image: url("listArrow2.gif"); }  CSS List Position  ul { list-style-position: inside; }  ol { list-style-position: outside; }
  • 21. CSS Box Model  All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout.  The CSS box model is essentially a box that wraps around HTML elements, and it consists of: margins, borders, padding, and the actual content.  The box model allows us to place a border around elements and space elements in relation to other elements.
  • 22.
  • 23. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model  Every rendered element occupies a box: (or inner edge) (or outer edge)
  • 24. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model
  • 25. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model
  • 26. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model
  • 27. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model
  • 28. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model
  • 29. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model
  • 30. Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides CSS Box Model
  • 31.  Margin - Clears an area around the border. The margin does not have a background color, it is completely transparent  Border - A border that goes around the padding and content. The border is inherited from the color property of the box  Padding - Clears an area around the content. The padding is affected by the background color of the box  Content - The content of the box, where text and images appear
  • 32. example  <!DOCTYPE html>  <html><head>  <style>  div.ex {  width: 220px;  padding: 10px;  border: 5px solid gray;  margin: 0px;  }  </style>  </head>  <body> <img src="w3css.gif" width="250" height="250">  <div class="ex">The picture above is 250px wide. The total width of this element is also 250px.</div> </body>  </html>
  • 33.  The total width of an element should be calculated like this:  Total element width = width + left padding + right padding + left border + right border + left margin + right margin  The total height of an element should be calculated like this:  Total element height = height + top padding + bottom padding + top border + bottom border + top margin + bottom margi
  • 34. CSS Border  <head>  <style>  p.none {border-style: none;}  p.dotted {border-style: dotted;}  p.dashed {border-style: dashed;}  p.solid {border-style: solid;}  p.double {border-style: double;}  p.groove {border-style: groove;}  p.ridge {border-style: ridge;}  p.inset {border-style: inset;}  p.outset {border-style: outset;}  p.hidden {border-style: hidden;}  </style>  </head>  <body>
  • 35.  <p class="none">No border.</p>  <p class="dotted">A dotted border.</p>  <p class="dashed">A dashed border.</p>  <p class="solid">A solid border.</p>  <p class="double">A double border.</p>  <p class="groove">A groove border.</p>  <p class="ridge">A ridge border.</p>  <p class="inset">An inset border.</p>  <p class="outset">An outset border.</p>  <p class="hidden">A hidden border.</p>  </body>  </html>
  • 37. Positioning  There are four different positioning methods. 1. Static Positioning 2. Fixed Positioning 3. Relative Positioning 4. Absolute Positioning
  • 38. Static Positioning  HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page.
  • 39. Fixed Positioning  An element with fixed position is positioned relative to the browser window  p.pos_fixed { position: fixed; top: 30px; right: 5px; }
  • 40. example  <!DOCTYPE html>  <html><head>  <style>  p.pos_fixed {  position: fixed;  top: 30px;  right: 5px;  color: red;  }  </style></head>  <body><p><b>Note:</b> IE7 and IE8 supports the fixed value only if a !DOCTYPE is specified.</p>  <p>Some text</p>  <p class="pos_fixed">Some positioned text.</p>  </body>  </html>
  • 42. Relative Positioning  A relative positioned element is positioned relative to its normal position.  Example  h2.pos_left { position: relative; left: -20px; } h2.pos_right { position: relative; left: 20px; }
  • 43. example  <!DOCTYPE html>  <html><head><style>  h2.pos_left {  position: relative;  left: -20px;} h2.pos_right {  position: relative;  left: 20px;  }</style></head>  <body> <h2>Heading with no position</h2> <h2 class="pos_left">This heading is moved left according to its normal position</h2>  <h2 class="pos_right">This heading is moved right according to its normal position</h2></body></html>
  • 45. Absolute Positioning  An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is <html>:  Example  h2 { position: absolute; left: 100px; top: 150px; }
  • 46. Example  <!DOCTYPE html>  <html><head>  <style>  h2 {  position: absolute;  left: 100px;  top: 150px;  }</style>  </head><body> <h2>This heading has an absolute position</h2> <p>With absolute positioning, an element can be placed anywhere on a page. The heading below is placed 100px from the left of the page and 150px from the top of the page.</p> </body></html>
  • 48. CSS Cursor Icons  default - Display the normal mouse cursor icon  wait - The mouse icon to represent the computer "thinking"  crosshair - A cross hair reticle  text - An "I" shaped icon that is displayed when selecting text  pointer - A hand icon that you see when you hover over an HTML link  help - A question mark (usually)
  • 49. CSS Cursor Code  <html>  <head>  <style> p { cursor: wait; } h4 { cursor: help; }  h5 { cursor: crosshair; } </style>  </head>  <body>  <h4>We Want to Help You!</h4>  <p>This may take a while to load....so don't worry, be happy!</p>  <h5>Do You Like To Play Shooting Games on the Computer?</h5>  </body>  </html>