SlideShare a Scribd company logo
 
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!

More Related Content

What's hot

Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
Cascading style sheets - CSS
Cascading style sheets - CSSCascading style sheets - CSS
Cascading style sheets - CSS
iFour Institute - Sustainable Learning
 
Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)
Reshmi Rajan
 
Css ppt
Css pptCss ppt
Css ppt
Nidhi mishra
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
Santhiya Grace
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
 
CSS
CSS CSS
CSS
Sunil OS
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
Css.html
Css.htmlCss.html
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Amit Tyagi
 
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
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
KushagraChadha1
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
Michael Jhon
 
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)
Webtech Learning
 
Html
HtmlHtml

What's hot (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
 

Viewers also liked

[전파교육] css day 2014
[전파교육] css day 2014[전파교육] css day 2014
[전파교육] css day 2014
Kyoung Hwan Min
 
javascript3
javascript3javascript3
javascript3
osman 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, padding
Hyejin Oh
 
[CSS Drawing] Basic Tutorial (라이언 그리기)
[CSS Drawing] Basic Tutorial (라이언 그리기)[CSS Drawing] Basic Tutorial (라이언 그리기)
[CSS Drawing] Basic Tutorial (라이언 그리기)
Hyejin Oh
 
CSS font-stacks
CSS font-stacksCSS font-stacks
CSS font-stacks
Russ Weakley
 
[Basic HTML/CSS] 7. project
[Basic HTML/CSS] 7. project[Basic HTML/CSS] 7. project
[Basic HTML/CSS] 7. project
Hyejin Oh
 
PROGRESS - CSS BASIC
PROGRESS - CSS BASICPROGRESS - CSS BASIC
PROGRESS - CSS BASIC
UKM 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 Form
Nosheen Qamar
 
HTML Dasar : #10 Form
HTML Dasar : #10 FormHTML Dasar : #10 Form
HTML Dasar : #10 Form
Sandhika Galih
 
[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
Hyejin 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 tags
Hyejin Oh
 
Java script basic
Java script basicJava script basic
Java script basic
Vithushan Vinayagamoorthy
 
CSS3 notes
CSS3 notesCSS3 notes
CSS3 notes
Rex Wang
 
Chapter 12
Chapter 12Chapter 12

Viewers also liked (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
 

Similar to Basic css

How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
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 Mistakessanjay2211
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
Yoeung Vibol
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2Shawn Calvert
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
Sean Wolfe
 
Css basics
Css basicsCss basics
Css basics
ASIT
 
Web Programming-css.pptx
Web Programming-css.pptxWeb Programming-css.pptx
Web Programming-css.pptx
MarwaAnany1
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
Thapar Institute
 
Css from scratch
Css from scratchCss from scratch
Css from scratch
Ahmad Al-ammar
 
CSS
CSSCSS
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
Swapnali Pawar
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
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
 

Similar to 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
 

Recently uploaded

Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
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
 
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
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
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
 

Recently uploaded (20)

Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
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
 
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)
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
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
 

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.