SlideShare ist ein Scribd-Unternehmen logo
1 von 32
 
Basics By Gopinath Ambothi CSS
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Index
What is CSS? ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],Why CSS?
<link rel=“stylesheet”type=“text/css”href=“style.css”/> HTML<html><head>  <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=“style.css&quot; /> </head>…</html> … … … … style.css … … … … … sample.html Reference CSS from HTML
CSS Syntax h1 { color: red; background: yellow; } Selector Style Block Element Properties Style Values •  The  Selector  selects elements on the HTML page. •  The associated  Style Block  applies its  Style Values  to the selected  Element’s Properties
[object Object],[object Object],[object Object],[object Object],ID and Class The ‘ID’ Selector In addition to setting a style for a HTML element, CSS allows you to specify your own selectors called &quot;id&quot; and &quot;class&quot;.
[object Object],[object Object],[object Object],[object Object],[object Object],ID and Class The ‘Class’ Selector
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)
Selectors 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.
Selectors 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.
Selectors 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.
Selectors 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 ( C ascading SS ), 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 ,  elementtype  (ambiguous) • Combine selectors: Elementype.classname or Elementype#idname e.g. p.legs   [ or]  h2#snout
Sharpen your Selector • 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.pigp.pig-head #snout • HTML Tree: <body class=“pig”> <p class=“pig-head”> <h1 id=“snout”> Snout SnoutSnout </h1> </p> </body>
Basic CSS Tags & Properties
<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
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
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)
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; orunderline; text-transform: Capitalize; Line-height: added vertical space to each line of text according to size
List Properties 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
Position Properties Absolute  - The box is placed in an absolute location relative to the container block. The element's position is specified with the &quot;left&quot;, &quot;top&quot;, &quot;right&quot;, and &quot;bottom&quot; properties Fixed  - Generates an absolutely positioned element, positioned relative to the browser window. The element's position is specified with the &quot;left&quot;, &quot;top&quot;, &quot;right&quot;, and &quot;bottom&quot; properties Relative  - Generates a relatively positioned element, positioned relative to its normal position, so &quot;left:20&quot; adds 20 pixels to the element's LEFT position Static  - Default. No position, the element occurs in the normal flow (ignores any top, bottom, left, right, or z-index declarations) Inherit  - The element should have the same position value as the parent element. Example:  http://www.w3schools.com/Css/tryit.asp?filename= trycss_position_relative
Float Properties With CSS float, an element can be pushed to the  Left   or   Right   allowing other elements to wrap around it. Float is very often used for images, but it is also useful when working with layouts. How Elements Float? Elements are floated horizontally, this means that an element can only be floated left or right, not up or down. A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element. The elements after the floating element will flow around it. The elements before the floating element will not be affected.
CSS Box Model 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. The image below illustrates the box model:
Use Firebug / IE developer tool bar  ,[object Object],[object Object],[object Object],[object Object]
Thank You!

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Cascading style sheets - CSS
Cascading style sheets - CSSCascading style sheets - CSS
Cascading style sheets - CSS
 
Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)
 
Css ppt
Css pptCss ppt
Css ppt
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
 
CSS
CSSCSS
CSS
 
CSS
CSS CSS
CSS
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Css.html
Css.htmlCss.html
Css.html
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
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
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Css
CssCss
Css
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
Html
HtmlHtml
Html
 
CSS
CSSCSS
CSS
 

Andere mochten auch

[전파교육] css day 2014
[전파교육] css day 2014[전파교육] css day 2014
[전파교육] css day 2014Kyoung Hwan Min
 
javascript3
javascript3javascript3
javascript3osman do
 
Java script introducation & basics
Java script introducation & basicsJava script introducation & basics
Java script introducation & basicsH K
 
[Basic HTML/CSS] 6. css - box sizing, display, margin, padding
[Basic HTML/CSS] 6. css - box sizing, display, margin, padding[Basic HTML/CSS] 6. css - box sizing, display, margin, padding
[Basic HTML/CSS] 6. css - box sizing, display, margin, paddingHyejin Oh
 
[CSS Drawing] Basic Tutorial (라이언 그리기)
[CSS Drawing] Basic Tutorial (라이언 그리기)[CSS Drawing] Basic Tutorial (라이언 그리기)
[CSS Drawing] Basic Tutorial (라이언 그리기)Hyejin Oh
 
[Basic HTML/CSS] 7. project
[Basic HTML/CSS] 7. project[Basic HTML/CSS] 7. project
[Basic HTML/CSS] 7. projectHyejin Oh
 
PROGRESS - CSS BASIC
PROGRESS - CSS BASICPROGRESS - CSS BASIC
PROGRESS - CSS BASICUKM PROGRESS
 
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]Aaron Gustafson
 
Web engineering - HTML Form
Web engineering -  HTML FormWeb engineering -  HTML Form
Web engineering - HTML FormNosheen Qamar
 
[Basic HTML/CSS] 4. html - form tags
[Basic HTML/CSS] 4. html - form tags[Basic HTML/CSS] 4. html - form tags
[Basic HTML/CSS] 4. html - form tagsHyejin Oh
 
[Basic HTML/CSS] 3. html - table tags
[Basic HTML/CSS] 3. html - table tags[Basic HTML/CSS] 3. html - table tags
[Basic HTML/CSS] 3. html - table tagsHyejin Oh
 
CSS3 notes
CSS3 notesCSS3 notes
CSS3 notesRex Wang
 

Andere mochten auch (20)

[전파교육] css day 2014
[전파교육] css day 2014[전파교육] css day 2014
[전파교육] css day 2014
 
CSS3
CSS3CSS3
CSS3
 
CSS
CSSCSS
CSS
 
javascript3
javascript3javascript3
javascript3
 
Java script introducation & basics
Java script introducation & basicsJava script introducation & basics
Java script introducation & basics
 
[Basic HTML/CSS] 6. css - box sizing, display, margin, padding
[Basic HTML/CSS] 6. css - box sizing, display, margin, padding[Basic HTML/CSS] 6. css - box sizing, display, margin, padding
[Basic HTML/CSS] 6. css - box sizing, display, margin, padding
 
[CSS Drawing] Basic Tutorial (라이언 그리기)
[CSS Drawing] Basic Tutorial (라이언 그리기)[CSS Drawing] Basic Tutorial (라이언 그리기)
[CSS Drawing] Basic Tutorial (라이언 그리기)
 
CSS font-stacks
CSS font-stacksCSS font-stacks
CSS font-stacks
 
[Basic HTML/CSS] 7. project
[Basic HTML/CSS] 7. project[Basic HTML/CSS] 7. project
[Basic HTML/CSS] 7. project
 
PROGRESS - CSS BASIC
PROGRESS - CSS BASICPROGRESS - CSS BASIC
PROGRESS - CSS BASIC
 
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
HTML5 Smart Markup for Smarter Websites [FoWD NYC 2011]
 
Web engineering - HTML Form
Web engineering -  HTML FormWeb engineering -  HTML Form
Web engineering - HTML Form
 
HTML Dasar : #10 Form
HTML Dasar : #10 FormHTML Dasar : #10 Form
HTML Dasar : #10 Form
 
[Basic HTML/CSS] 4. html - form tags
[Basic HTML/CSS] 4. html - form tags[Basic HTML/CSS] 4. html - form tags
[Basic HTML/CSS] 4. html - form tags
 
[Basic HTML/CSS] 3. html - table tags
[Basic HTML/CSS] 3. html - table tags[Basic HTML/CSS] 3. html - table tags
[Basic HTML/CSS] 3. html - table tags
 
Basic css-tutorial
Basic css-tutorialBasic css-tutorial
Basic css-tutorial
 
Java script basic
Java script basicJava script basic
Java script basic
 
Color For Dummies
Color For DummiesColor For Dummies
Color For Dummies
 
CSS3 notes
CSS3 notesCSS3 notes
CSS3 notes
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 

Ähnlich wie Basic css

Ähnlich wie Basic css (20)

Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
CSS
CSSCSS
CSS
 
Basics Of Css And Some Common Mistakes
Basics Of Css And Some Common MistakesBasics Of Css And Some Common Mistakes
Basics Of Css And Some Common Mistakes
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 
Css
CssCss
Css
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
 
Css basics
Css basicsCss basics
Css basics
 
Web Programming-css.pptx
Web Programming-css.pptxWeb Programming-css.pptx
Web Programming-css.pptx
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
 
Css from scratch
Css from scratchCss from scratch
Css from scratch
 
CSS-part-1.ppt
CSS-part-1.pptCSS-part-1.ppt
CSS-part-1.ppt
 
CSS
CSSCSS
CSS
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
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
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
 

Kürzlich hochgeladen

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 

Kürzlich hochgeladen (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 

Basic css

  • 1.  
  • 2. Basics By Gopinath Ambothi CSS
  • 3.
  • 4.
  • 5.
  • 6. <link rel=“stylesheet”type=“text/css”href=“style.css”/> HTML<html><head> <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=“style.css&quot; /> </head>…</html> … … … … style.css … … … … … sample.html Reference CSS from HTML
  • 7. CSS Syntax h1 { color: red; background: yellow; } Selector Style Block Element Properties Style Values • The Selector selects elements on the HTML page. • The associated Style Block applies its Style Values to the selected Element’s Properties
  • 8.
  • 9.
  • 10. 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)
  • 11. Selectors 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.
  • 12. Selectors 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.
  • 13. Selectors 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.
  • 14. Selectors 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.
  • 15. 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.
  • 16. Conflict Resolution • It’s possible to have different styles applied to the same selector ( C ascading SS ), 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 ?
  • 17. Sharpen your Selector • Order of specificity: (specific) id , class , elementtype (ambiguous) • Combine selectors: Elementype.classname or Elementype#idname e.g. p.legs [ or] h2#snout
  • 18. Sharpen your Selector • 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.pigp.pig-head #snout • HTML Tree: <body class=“pig”> <p class=“pig-head”> <h1 id=“snout”> Snout SnoutSnout </h1> </p> </body>
  • 19. Basic CSS Tags & Properties
  • 20. <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.”
  • 21. <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
  • 22. 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
  • 23. 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)
  • 24. 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;
  • 25. 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
  • 26. List Properties 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
  • 27. 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
  • 28. Position Properties Absolute - The box is placed in an absolute location relative to the container block. The element's position is specified with the &quot;left&quot;, &quot;top&quot;, &quot;right&quot;, and &quot;bottom&quot; properties Fixed - Generates an absolutely positioned element, positioned relative to the browser window. The element's position is specified with the &quot;left&quot;, &quot;top&quot;, &quot;right&quot;, and &quot;bottom&quot; properties Relative - Generates a relatively positioned element, positioned relative to its normal position, so &quot;left:20&quot; adds 20 pixels to the element's LEFT position Static - Default. No position, the element occurs in the normal flow (ignores any top, bottom, left, right, or z-index declarations) Inherit - The element should have the same position value as the parent element. Example: http://www.w3schools.com/Css/tryit.asp?filename= trycss_position_relative
  • 29. Float Properties With CSS float, an element can be pushed to the Left or Right allowing other elements to wrap around it. Float is very often used for images, but it is also useful when working with layouts. How Elements Float? Elements are floated horizontally, this means that an element can only be floated left or right, not up or down. A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element. The elements after the floating element will flow around it. The elements before the floating element will not be affected.
  • 30. CSS Box Model 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. The image below illustrates the box model:
  • 31.