SlideShare a Scribd company logo
Basic CSS

  Author: Dwight VanTuyl
Created: September 29, 2008
     The LINGUIST List
What is CSS?
• Cascading: Multiple styles can overlap in order
  to specify a range of style from a whole web site
  down to a unique element. Which style gets
  applied pertains to the rules of CSS cascading
  logic.
• Style: CSS deals specifically with the
  presentation domain of designing a web page
  (color, font, layout, etc).
• Sheet: Normally, CSS is a file separate from the
  HTML file – linked to the HTML file through its
  <head> (exceptions apply).
Why CSS?
• Allows for much richer document appearances
  than HTML.
• Reduce workload by centralizing commands for
  visual appearance instead of scattered
  throughout the HTML doc.
• Use same style on multiple pages.
• Reduce page download size.

 Use HTML for content; CSS for Presentation.
Reference CSS from HTML
   <link rel=“stylesheet” type=“text/css” href=“lipstick.css” />




              pig.html                           lipstick.css
<html>
          <head>
          <link rel="stylesheet"
          type="text/css"
          href=“lipstick.css" />
          </head>
  …
</html>
CSS Syntax
     Selector                   Style Block

       h1          {
                       color: red;                          Style
 Element                                                    Values
 Properties            background: yellow;
                   }

•The Selector selects elements on the HTML page.
•The associated Style Block applies its Style Values to the selected
Element’s Properties
Selectors
• Select elements to apply a declared style.
• Selector types:
  – Element Selectors: selects all elements of a
    specific type (<body>, <h1>, <p>, etc.)
  – Class Selectors: selects all elements that
    belong to a given class.
  – ID Selectors: selects a single element that’s
    been given a unique id.
  – Pseudo Selectors: combines a selector with a
    user activated state (:hover, :link, :visited)
Element Selectors
• Finds all HTML elements that have the specified
  element type.
• Example:

                h1 {
                       color: blue;
                }

Finds all elements of type <h1> and makes the
  text color blue.
Class Selectors
• Finds all elements of a given class – based on the
  attribute’s class value.
• Syntax: .classname (Remember the dot means class
  selector)
• Example:

              .legs {
                  font-weight: bold;
                  background: pink;
              }

Finds all elements whose class = “legs” and makes their
   font bold and their backgrounds pink.
ID Selectors
• Finds a single element that’s been given a
  unique id – based on the attribute’s id value.
• Syntax: #idname (Remember the pound-sign
  means id selector)
• Example:

            #snout{
                border: solid red;
            }

Finds a single element whose id = “snout” and
  gives it a solid red border.
Pseudo-Selectors
• Apply styles to a user activated state of an
  element.
• If used, must be declared in a specific order in
  the style sheet.
• 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.
Grouping Selectors
• Lets say you want to apply the same style to several
  different selectors. Don’t repeat the style – use a
  comma!!
• Syntax: sel1, sel2, sel3 (Remember the comma to
  group several different selectors)
• Example:

               h1, .legs, #snout{
                   font-size: 20pt;
               }

Finds all elements of type <h1>, all elements with
   class=“legs” and the single element whose id = “snout”
   then makes their font-size 20pt.
Conflict Resolution
• It’s possible to have different styles
  applied to the same selector
  (CascadingSS), but what if the styles tell
  the browser to do conflicting things?
• Rules:
  – Which selector is more specific?
  – If the selectors are the same, then which style
    was applied last?
Sharpen Your Selector
• Order of specificity:
     (specific) id, class, element type (ambiguous)



• Combine selectors:
     Elementype.classname or Elementype#idname


     e.g.        p.legs        or       h2#snout
Sharpen Your Selector (cont.)
• Descendant Selectors:
     Specify the context in the HTML tree from each ancestor down to the
       desired element – each separated by a space.

     e.g.    body.pig     p.pig-head      #snout

• HTML Tree:
     <body class=“pig”>
           <p class=“pig-head”>
                  <h1 id=“snout”>
                        Snout Snout Snout
                  </h1>
           </p>
     </body>
Firebug – Firefox Addon
• Tool for figuring out what styles are being
  applied to which element (and which are being
  overwritten due to conflict resolution).

• http://getfirebug.com/

• Right-click on an element,
  then select “Inspect Element” from the dropdown
    menu.
<span> Element tag
• Useful for applying style to text within
  another HTML element.
• Use SPARINGLY – unlike <h1> or <p>,
  <span> has no semantic meaning.
• Remember, HTML is for content and
  HTML tags are for describing that content
  to non-human or visually-impaired
  readers. <span> is just used to make
  things “pretty.”
<div> Element tag
• Useful for dividing parts of the page into sections.
• Creates a “box” with the following attributes:
   –   margin
   –   padding
   –   border
   –   height
   –   width
   –   (..and lots more)


• Primary element used for CSS Layouts
  (more information in CSS Layouts tutorial)
Color Properties
• color: specifies the text color.
• background-color: specifies the background color.

            black; or #000000;
            red; or #FF0000;
            lime; or #00FF00;
            blue; or #0000FF;
            white; or #000000;

…and more see:
  http://www.w3schools.com/css/css_colornames.asp
Colorzilla – Firefox Addon
• Easily find color values for elements in a
  document.
• http://www.iosart.com/firefox/colorzilla/
• Click on the eyedropper icon in the
  bottom-left of the browser and select any
  color in your browser window.
• Right-click on the eyedropper for more
  options.
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: (scroll or fixed)
Font Properties
• font-family: times, arial, serif, sans-serif,
  monospace;
• font-style: italic;
• font-weight: (bold, bolder, lighter, or 100 – 900;)
• font-size: size;
  …or shorthand
• font: style weight size family;
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; or underline;
• text-transform: Capitalize;
• Line-height: added vertical space to each
  line of text according to size
List Properties <ul>
• list-style-type: none, disc, circle, square,
  (other types available)
• list-style-position: inside or outside
• list-style-image: url(../path/to/image.jpg)

  …or shorthand
• list-style: type position image
Border Properties
• border-width: (thin, medium, thick, or size)
• border-style: (none, hidden, dotted, dashed,
  solid, double, groove, ridge, inset, or outset)
• border-color: color

  …or shorthand
• border(-top, -right, -left, -bottom): width style
  color

More Related Content

What's hot

CSS 101
CSS 101CSS 101
CSS 101
dunclair
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
Marc Huang
 
CSS tutorial chapter 2
CSS tutorial chapter 2CSS tutorial chapter 2
CSS tutorial chapter 2
jeweltutin
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
M Ashraful Islam Jewel
 
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
jeweltutin
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
Russ Weakley
 
CSS
CSSCSS
Css ppt
Css pptCss ppt
Css ppt
Nidhi mishra
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
Toni Kolev
 
Css.html
Css.htmlCss.html
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
Castro Chapter 7
Castro Chapter 7Castro Chapter 7
Castro Chapter 7Jeff Byrnes
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
Yoeung Vibol
 

What's hot (20)

Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Css
CssCss
Css
 
CSS 101
CSS 101CSS 101
CSS 101
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
 
CSS tutorial chapter 2
CSS tutorial chapter 2CSS tutorial chapter 2
CSS tutorial chapter 2
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
 
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
CSS
CSSCSS
CSS
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
 
Css ppt
Css pptCss ppt
Css ppt
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
 
Css.html
Css.htmlCss.html
Css.html
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Castro Chapter 7
Castro Chapter 7Castro Chapter 7
Castro Chapter 7
 
Introduction 2 css
Introduction 2 cssIntroduction 2 css
Introduction 2 css
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 

Viewers also liked

Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...tutorialsruby
 
Bob Hoogenboom
Bob HoogenboomBob Hoogenboom
Making%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20WindowsMaking%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20Windowstutorialsruby
 

Viewers also liked (7)

v02-types.en
v02-types.env02-types.en
v02-types.en
 
resume-jake-miles
resume-jake-milesresume-jake-miles
resume-jake-miles
 
Jeni Intro2 Bab06 Algoritma Sorting
Jeni Intro2 Bab06 Algoritma SortingJeni Intro2 Bab06 Algoritma Sorting
Jeni Intro2 Bab06 Algoritma Sorting
 
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
Content Outside of CONTENTdm: Part 1: Exhibit Creation Tool using &lt;b>...&l...
 
The_Perl_Review_0_6
The_Perl_Review_0_6The_Perl_Review_0_6
The_Perl_Review_0_6
 
Bob Hoogenboom
Bob HoogenboomBob Hoogenboom
Bob Hoogenboom
 
Making%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20WindowsMaking%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20Windows
 

Similar to Basic-CSS-tutorial

Ifi7174 lesson2
Ifi7174 lesson2Ifi7174 lesson2
Ifi7174 lesson2
Sónia
 
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company india
Jignesh Aakoliya
 
Unit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology projectUnit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
Sean Wolfe
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
Thapar Institute
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)
Saurabh Anand
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
MattMarino13
 
Css
CssCss
Css
CssCss
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
Cascading Style Sheets By Mukesh
Cascading Style Sheets By MukeshCascading Style Sheets By Mukesh
Cascading Style Sheets By Mukesh
Mukesh Kumar
 
Cascading style sheet an introduction
Cascading style sheet   an introductionCascading style sheet   an introduction
Cascading style sheet an introduction
Himanshu Pathak
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
MattMarino13
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
Jalpesh Vasa
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
Nosheen Qamar
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
Hawkman Academy
 

Similar to Basic-CSS-tutorial (20)

Ifi7174 lesson2
Ifi7174 lesson2Ifi7174 lesson2
Ifi7174 lesson2
 
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company india
 
Unit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology projectUnit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology project
 
Css
CssCss
Css
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Css
CssCss
Css
 
CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
 
Css
CssCss
Css
 
Css
CssCss
Css
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
Cascading Style Sheets By Mukesh
Cascading Style Sheets By MukeshCascading Style Sheets By Mukesh
Cascading Style Sheets By Mukesh
 
Cascading style sheet an introduction
Cascading style sheet   an introductionCascading style sheet   an introduction
Cascading style sheet an introduction
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
 

More from tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

More from tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Recently uploaded

Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 

Recently uploaded (20)

Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 

Basic-CSS-tutorial

  • 1. Basic CSS Author: Dwight VanTuyl Created: September 29, 2008 The LINGUIST List
  • 2. What is CSS? • Cascading: Multiple styles can overlap in order to specify a range of style from a whole web site down to a unique element. Which style gets applied pertains to the rules of CSS cascading logic. • Style: CSS deals specifically with the presentation domain of designing a web page (color, font, layout, etc). • Sheet: Normally, CSS is a file separate from the HTML file – linked to the HTML file through its <head> (exceptions apply).
  • 3. Why CSS? • Allows for much richer document appearances than HTML. • Reduce workload by centralizing commands for visual appearance instead of scattered throughout the HTML doc. • Use same style on multiple pages. • Reduce page download size. Use HTML for content; CSS for Presentation.
  • 4. Reference CSS from HTML <link rel=“stylesheet” type=“text/css” href=“lipstick.css” /> pig.html lipstick.css <html> <head> <link rel="stylesheet" type="text/css" href=“lipstick.css" /> </head> … </html>
  • 5. CSS Syntax Selector Style Block h1 { color: red; Style Element Values Properties background: yellow; } •The Selector selects elements on the HTML page. •The associated Style Block applies its Style Values to the selected Element’s Properties
  • 6. Selectors • Select elements to apply a declared style. • Selector types: – Element Selectors: selects all elements of a specific type (<body>, <h1>, <p>, etc.) – Class Selectors: selects all elements that belong to a given class. – ID Selectors: selects a single element that’s been given a unique id. – Pseudo Selectors: combines a selector with a user activated state (:hover, :link, :visited)
  • 7. Element Selectors • Finds all HTML elements that have the specified element type. • Example: h1 { color: blue; } Finds all elements of type <h1> and makes the text color blue.
  • 8. Class Selectors • Finds all elements of a given class – based on the attribute’s class value. • Syntax: .classname (Remember the dot means class selector) • Example: .legs { font-weight: bold; background: pink; } Finds all elements whose class = “legs” and makes their font bold and their backgrounds pink.
  • 9. ID Selectors • Finds a single element that’s been given a unique id – based on the attribute’s id value. • Syntax: #idname (Remember the pound-sign means id selector) • Example: #snout{ border: solid red; } Finds a single element whose id = “snout” and gives it a solid red border.
  • 10. Pseudo-Selectors • Apply styles to a user activated state of an element. • If used, must be declared in a specific order in the style sheet. • 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.
  • 11. Grouping Selectors • Lets say you want to apply the same style to several different selectors. Don’t repeat the style – use a comma!! • Syntax: sel1, sel2, sel3 (Remember the comma to group several different selectors) • Example: h1, .legs, #snout{ font-size: 20pt; } Finds all elements of type <h1>, all elements with class=“legs” and the single element whose id = “snout” then makes their font-size 20pt.
  • 12. Conflict Resolution • It’s possible to have different styles applied to the same selector (CascadingSS), but what if the styles tell the browser to do conflicting things? • Rules: – Which selector is more specific? – If the selectors are the same, then which style was applied last?
  • 13. Sharpen Your Selector • Order of specificity: (specific) id, class, element type (ambiguous) • Combine selectors: Elementype.classname or Elementype#idname e.g. p.legs or h2#snout
  • 14. Sharpen Your Selector (cont.) • Descendant Selectors: Specify the context in the HTML tree from each ancestor down to the desired element – each separated by a space. e.g. body.pig p.pig-head #snout • HTML Tree: <body class=“pig”> <p class=“pig-head”> <h1 id=“snout”> Snout Snout Snout </h1> </p> </body>
  • 15. Firebug – Firefox Addon • Tool for figuring out what styles are being applied to which element (and which are being overwritten due to conflict resolution). • http://getfirebug.com/ • Right-click on an element, then select “Inspect Element” from the dropdown menu.
  • 16. <span> Element tag • Useful for applying style to text within another HTML element. • Use SPARINGLY – unlike <h1> or <p>, <span> has no semantic meaning. • Remember, HTML is for content and HTML tags are for describing that content to non-human or visually-impaired readers. <span> is just used to make things “pretty.”
  • 17. <div> Element tag • Useful for dividing parts of the page into sections. • Creates a “box” with the following attributes: – margin – padding – border – height – width – (..and lots more) • Primary element used for CSS Layouts (more information in CSS Layouts tutorial)
  • 18. Color Properties • color: specifies the text color. • background-color: specifies the background color. black; or #000000; red; or #FF0000; lime; or #00FF00; blue; or #0000FF; white; or #000000; …and more see: http://www.w3schools.com/css/css_colornames.asp
  • 19. Colorzilla – Firefox Addon • Easily find color values for elements in a document. • http://www.iosart.com/firefox/colorzilla/ • Click on the eyedropper icon in the bottom-left of the browser and select any color in your browser window. • Right-click on the eyedropper for more options.
  • 20. 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: (scroll or fixed)
  • 21. Font Properties • font-family: times, arial, serif, sans-serif, monospace; • font-style: italic; • font-weight: (bold, bolder, lighter, or 100 – 900;) • font-size: size; …or shorthand • font: style weight size family;
  • 22. 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; or underline; • text-transform: Capitalize; • Line-height: added vertical space to each line of text according to size
  • 23. List Properties <ul> • list-style-type: none, disc, circle, square, (other types available) • list-style-position: inside or outside • list-style-image: url(../path/to/image.jpg) …or shorthand • list-style: type position image
  • 24. Border Properties • border-width: (thin, medium, thick, or size) • border-style: (none, hidden, dotted, dashed, solid, double, groove, ridge, inset, or outset) • border-color: color …or shorthand • border(-top, -right, -left, -bottom): width style color