Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
How CSS works  Prepared By:  Md. Sirajus Salayhin Assistant Programmer Nanosoft Email:  [email_address] Web:  http://nanoit.biz
What is CSS C ascading  S tyle  S heets  Contains the rules for the  presentation  of HTML.   +  =  HTML CSS Web Page CSS was introduced to keep the  presentation  information  separate  from  HTML  markup (content).
Before CSS Initially Designers used presentation tags like (FONT, B, BR,  TABLE  etc.) and  spacers GIFs  to control the design of web pages.
Any  modification  in the design of websites was a very  difficult  and  boring  task , as it evolves  manually  editing  every HTML page.
Providing support for multiple browsers was a difficult task.
CSS – brief history  Style sheets have existed in one form or another since the beginnings of SGML in the 1970s. In 1996,  CSS level 1  Recommendation was published in December.  CSS level2  was published as a W3C Recommendation on May 12, 1998  CSS level3  is still under development.
Sources of Styles Author (developer) Styles  Inline Styles  - As inline attribute “style” inside HTML tags <div  style=“font-weight: bold;” >I am bold</div> Embedded Styles -  As embedded style tag with in HTML document. <html> <head> <title>Welcome to Vendio!</title>  <style> .footer { width:90%; } </style> ------- </html> Linked Styles  -  Inside separate files with .css extension <link rel=&quot;stylesheet&quot; href=“external.css&quot; type=&quot;text/css&quot; />
Sources of Styles(contd.) User Style sheets This file contains the user created styles . [firefox profile folder]/ chrome/userContent-example.css  is the current user’s style sheet file for the firefox. Browser default style sheet This file contains default styles for all users of a  browser [firefox folder]/res/html.css  is the default style sheet file for the firefox.
Cascade The CSS cascade assigns a weight to each style rule. When several rules apply, the one with the greatest weight takes precedence.   Order of preference for various styles: Default browser style sheet ( weakest )  User style sheet Author style sheet Author embedded styles Author inline styles ( strongest )
CSS Selectors  ID based ( #) HTML CSS <div  id =“content”>   # content { Text width: 200px; </div> } ID selectors should be used with  single  elements.
Class based selector  Class (.) HTML CSS <div  class =“big”>   . content { Text width: 200px; </div> } <div> <span  class =“big”>some text </span> </div> Class based styles can be used by  multiple  HTML elements.
Tag based selectors Tag  (Tag name) HTML CSS < div >   DIV  { Text width: 200px; </div> } < div > SPAN  { < span >some text </span> font-size:130%; </div> } < span >some other text </span>
Grouping  Multiple selectors can be grouped in a single style declaration by using , . H1 ,  P  ,  .main { font-weight:bold; }
Descendant selectors Descendant selectors are used to select elements that are descendants ( not necessarily children ) of another element in the document tree.   HTML CSS < div class=“abc” > DIV.abc P  {   <div>   font-weight:bold;    < P > }   Hello there!    </p>   </div> </div>
Child selectors A child selector is used to select an element that is a direct child of another element (parent). Child selectors will not select all descendants, only direct children.  HTML CSS <div > DIV.abc  >  P {   < div class=“abc” >   font-weight:bold;    < P > }   Hello there!    </p>   </div> </div>
Universal selectors Universal selectors are used to select any element. *  { color: blue; }
Adjacent sibling selectors Adjacent sibling selectors will select the sibling immediately following an element.  DIV.abc  +  P { font-weight: bold; } will work for  <div> < div  class=“abc”>Message</div> < P >Hello there!</p> </div>
Attribute selectors Attribute selectors selects elements based upon the attributes present in the HTML Tags and their value. IMG [src=&quot;small.gif&quot;]  {  border: 1px solid #000;  }   will work for  <img  src=“small.gif”  />
CSS Pseudo-classes selector:pseudo-class { property: value } :link :visited  }  Link (A tag) related pseudo classes :hover  :active  :after :before :first-child :focus :first-letter :first-line :lang
CSS Values Words:   text-align: center ;. Numerical values:   Numerical values are usually followed by a unit type.  font-size:12 px ; 12 is the numerical value and px is the unit type pixels. Absolute Values – in, pc, px, cm, mm, pt  Relative Values – em, ex, % Color values:   color :#336699  or color#369.
Categories of CSS properties Positioning and layout handling related. Background related properties.  Font and text related  Links related. Lists related. Table related.
Box model
The Display Property Block Level elements , such as DIVs, paragraphs, headings, and lists,  sit one above another  when displayed in the browser. HTML <body> <div id=“div1”></div>   <div id=“div2”></div>   <div id=“div3”></div> </body> CSS #div1 { width:300px;background:yellow;} #div1 { width:300px;background:blue;} #div1 { width:300px;background:orange;}
Inline Elements   Inline elements  such as a, span, and img,  sit side by side  when they are displayed in the browser and only appear on a new line if there is insufficient room on the previous one. <div id=&quot;row1&quot; > <span class=&quot;norm&quot;>This is small text and </span> <span class=&quot;big&quot;>this is big</span> <span class=&quot;italicText&quot;> I am Italic</span> </div> .norm { color : red ; } .big { color : blue ; font-weight : bold ; } .italicText { color : green ; font-style : italic ; } #row1 { padding :10px; border : solid  1px #000; }
Display property  none inline block list-item run-in compact marker table inline-table inline-block table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption
Visibility Visible  : The element is visible (default). Hidden  : The element is invisible (but still takes up space) .big { visibility : hidden ; }
z-index The z-index property specifies the  stack order  of an element. An element with  greater stack order is always in front  of an element with a lower stack order. only works on  positioned elements  (position:absolute, position:relative, or position:fixed).
Default page flow Always think of web page as  3D arrangement  of different  layers .
Floating float : left ,  right ,  none ; A floated box is laid out according to the normal flow, then taken out of the flow and shifted to the left or right as far as possible.   IMG {  float : left ; }
Floating multiple elements Floated boxes will move to the left or right until their outer edge touches the containing block edge or the outer edge of another float.  <ul> <li>Home</li> <li>Products</li> <li>Services</li> <li>Contact Us</li> </ul> After applying  LI { float:left; }
Clearing Floats Clear:both ; Or  <style type=&quot;text/css&quot;>  .clearfix:after {  content: &quot;.&quot;; display: block; height: 0; clear: both; visibility: hidden; }  .clearfix {display: inline-block;} /* for IE/Mac */  </style> <!--[if IE]><style type=&quot;text/css&quot;>  .clearfix { zoom: 1; display: block; }  </style> <![endif]-->
Positioning - static position: static ; (Default option) the element occurs in the normal flow (ignores any top, bottom, left, right, or z-index declarations)
Positioning - relative position: relative ; Generates a relatively positioned element, positioned  relative to its normal position , use bottom, right, top and left property to place element. Default flow of other elements don’t change.
Positioning - absolute position: relative ; Generates an absolutely positioned element, positioned  relative to the first parent element that has a position other than static  (if none is found, relative to document’s BODY). use bottom, right, top and left property to place element
Positioning - fixed position: relative ; Generates an absolutely positioned element, positioned  relative to the browser window  and  don’t change even after page scroll . use bottom, right, top and left property to place element
Inheritance Styles that relate to  text and appearance   are  inherited  by the descendant elements.  Styles that relate to the appearance of boxes created by styling DIVs, paragraphs, and other elements, such as  borders, padding, margins  are  not inherited .
 
Refrences www.w3schools.com www.w3.org   World wide web

More Related Content

What's hot

Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
GuruPada Das
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
Toni Kolev
 
An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)
Ardee Aram
 
Css
CssCss
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
Randy Oest II
 
CSS ppt
CSS pptCSS ppt
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
casestudyhelp
 
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
 
Dom date and objects and event handling
Dom date and objects and event handlingDom date and objects and event handling
Dom date and objects and event handling
smitha273566
 
Unit iv xml dom
Unit iv xml domUnit iv xml dom
Unit iv xml dom
smitha273566
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
CSS tutorial chapter 2
CSS tutorial chapter 2CSS tutorial chapter 2
CSS tutorial chapter 2
jeweltutin
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
Pamela Fox
 
CSS
CSSCSS
Web Development - Lecture 6
Web Development - Lecture 6Web Development - Lecture 6
Web Development - Lecture 6
Syed Shahzaib Sohail
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Shehzad Yaqoob
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
 
Web Development - Lecture 4
Web Development - Lecture 4Web Development - Lecture 4
Web Development - Lecture 4
Syed Shahzaib Sohail
 

What's hot (20)

Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
 
An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)
 
Css
CssCss
Css
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
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
 
Dom date and objects and event handling
Dom date and objects and event handlingDom date and objects and event handling
Dom date and objects and event handling
 
Unit iv xml dom
Unit iv xml domUnit iv xml dom
Unit iv xml dom
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
CSS tutorial chapter 2
CSS tutorial chapter 2CSS tutorial chapter 2
CSS tutorial chapter 2
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
 
CSS
CSSCSS
CSS
 
Web Development - Lecture 6
Web Development - Lecture 6Web Development - Lecture 6
Web Development - Lecture 6
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
Web Development - Lecture 4
Web Development - Lecture 4Web Development - Lecture 4
Web Development - Lecture 4
 

Viewers also liked

Tampere 4.11.2011 - BTW koulussa
Tampere 4.11.2011 - BTW koulussaTampere 4.11.2011 - BTW koulussa
Tampere 4.11.2011 - BTW koulussa
Mikko Horila
 
Lighting earth (光之大地)
Lighting earth   (光之大地)Lighting earth   (光之大地)
Lighting earth (光之大地)
彥沂 官
 
Presentation
PresentationPresentation
Presentation
King Akan
 
Spiceworks Unplugged for HP
Spiceworks Unplugged for HPSpiceworks Unplugged for HP
Spiceworks Unplugged for HP
Auskosh
 
A Reason to Share
A Reason to ShareA Reason to Share
A Reason to Share
kimbui
 
Clinical Rubik's Cube: Global Clinical Trials in Hungary
Clinical Rubik's Cube: Global Clinical Trials in HungaryClinical Rubik's Cube: Global Clinical Trials in Hungary
Clinical Rubik's Cube: Global Clinical Trials in Hungary
Aleksandar Skuban, M.D.
 
Social entrepreneurship and social networks for sustainable rural development...
Social entrepreneurship and social networks for sustainable rural development...Social entrepreneurship and social networks for sustainable rural development...
Social entrepreneurship and social networks for sustainable rural development...
JIANGUANGLUNG DANGMEI
 
Brazil regions
Brazil regionsBrazil regions
Brazil regions
nickolas5696
 
Peskin chap02
Peskin chap02Peskin chap02
Peskin chap02
Javier Rencoret
 
Rcl
RclRcl
Tipos de publicidad
Tipos de publicidadTipos de publicidad
Tipos de publicidad
Samir Aristizábal
 
Cd visuals
Cd visualsCd visuals
Cd visuals
biddlebugs
 
Amazing prediction
Amazing predictionAmazing prediction
Amazing prediction
Ilpo Lehto
 
Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...
Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...
Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...
Mikko Horila
 
Spiceworks Unplugged Microsoft UK 30 Nov 11
Spiceworks Unplugged Microsoft UK 30 Nov 11Spiceworks Unplugged Microsoft UK 30 Nov 11
Spiceworks Unplugged Microsoft UK 30 Nov 11
Auskosh
 
Pepeljuga
PepeljugaPepeljuga
La energía estudiante 12
La energía  estudiante 12La energía  estudiante 12
La energía estudiante 12
mayi12
 

Viewers also liked (20)

Tampere 4.11.2011 - BTW koulussa
Tampere 4.11.2011 - BTW koulussaTampere 4.11.2011 - BTW koulussa
Tampere 4.11.2011 - BTW koulussa
 
Lighting earth (光之大地)
Lighting earth   (光之大地)Lighting earth   (光之大地)
Lighting earth (光之大地)
 
Presentation
PresentationPresentation
Presentation
 
Spiceworks Unplugged for HP
Spiceworks Unplugged for HPSpiceworks Unplugged for HP
Spiceworks Unplugged for HP
 
A Reason to Share
A Reason to ShareA Reason to Share
A Reason to Share
 
Clinical Rubik's Cube: Global Clinical Trials in Hungary
Clinical Rubik's Cube: Global Clinical Trials in HungaryClinical Rubik's Cube: Global Clinical Trials in Hungary
Clinical Rubik's Cube: Global Clinical Trials in Hungary
 
Social entrepreneurship and social networks for sustainable rural development...
Social entrepreneurship and social networks for sustainable rural development...Social entrepreneurship and social networks for sustainable rural development...
Social entrepreneurship and social networks for sustainable rural development...
 
Brazil regions
Brazil regionsBrazil regions
Brazil regions
 
Peskin chap02
Peskin chap02Peskin chap02
Peskin chap02
 
Tesseleringar
TesseleringarTesseleringar
Tesseleringar
 
Rcl
RclRcl
Rcl
 
Tipos de publicidad
Tipos de publicidadTipos de publicidad
Tipos de publicidad
 
Fazendavinicius
FazendaviniciusFazendavinicius
Fazendavinicius
 
Cd visuals
Cd visualsCd visuals
Cd visuals
 
Amazing prediction
Amazing predictionAmazing prediction
Amazing prediction
 
Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...
Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...
Tutkiva oppiminen, III kerta tekijanoikeudet ja sosiaalinen media yleensa, 10...
 
Spiceworks Unplugged Microsoft UK 30 Nov 11
Spiceworks Unplugged Microsoft UK 30 Nov 11Spiceworks Unplugged Microsoft UK 30 Nov 11
Spiceworks Unplugged Microsoft UK 30 Nov 11
 
Pepeljuga
PepeljugaPepeljuga
Pepeljuga
 
La energía estudiante 12
La energía  estudiante 12La energía  estudiante 12
La energía estudiante 12
 
Slide share guide
Slide share guideSlide share guide
Slide share guide
 

Similar to 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
 
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
 
Basic css
Basic cssBasic css
Basic css
Gopinath Ambothi
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
Likitha47
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 
Css introduction
Css  introductionCss  introduction
Css introduction
vishnu murthy
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
William Myers
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Amit Tyagi
 
An Introduction to CSS
An Introduction to CSSAn Introduction to CSS
An Introduction to CSS
John Catterfeld
 
1. Advanced Web Designing (12th IT) (1).pdf
1. Advanced Web Designing (12th IT) (1).pdf1. Advanced Web Designing (12th IT) (1).pdf
1. Advanced Web Designing (12th IT) (1).pdf
AAFREEN SHAIKH
 
Web Development 4
Web Development 4Web Development 4
Web Development 4
ghayour abbas
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
ghayour abbas
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS Methodology
Zohar Arad
 
Css from scratch
Css from scratchCss from scratch
Css from scratch
Ahmad Al-ammar
 
Introduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and JqueryIntroduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and Jquery
valuebound
 
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
sanjay2211
 
CSS_Dibbo
CSS_DibboCSS_Dibbo
CSS_Dibbo
Sayanton Vhaduri
 
Css
CssCss
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
Dave Kelly
 

Similar to CSS (20)

How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Basic css
Basic cssBasic css
Basic css
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
An Introduction to CSS
An Introduction to CSSAn Introduction to CSS
An Introduction to CSS
 
1. Advanced Web Designing (12th IT) (1).pdf
1. Advanced Web Designing (12th IT) (1).pdf1. Advanced Web Designing (12th IT) (1).pdf
1. Advanced Web Designing (12th IT) (1).pdf
 
Web Development 4
Web Development 4Web Development 4
Web Development 4
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS Methodology
 
Css from scratch
Css from scratchCss from scratch
Css from scratch
 
Introduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and JqueryIntroduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and Jquery
 
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_Dibbo
CSS_DibboCSS_Dibbo
CSS_Dibbo
 
Css
CssCss
Css
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 

Recently uploaded

DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
Edge AI and Vision Alliance
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
apoorva2579
 
How to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory ModelHow to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory Model
ScyllaDB
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
Eric D. Schabell
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
What's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdfWhat's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdf
SeasiaInfotech2
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
Liveplex
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
Alpen-Adria-Universität
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
The Digital Insurer
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
@Call @Girls Thiruvananthapuram 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...
@Call @Girls Thiruvananthapuram  🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...@Call @Girls Thiruvananthapuram  🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...
@Call @Girls Thiruvananthapuram 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...
kantakumariji156
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
The Digital Insurer
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
ScyllaDB
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 

Recently uploaded (20)

DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
 
How to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory ModelHow to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory Model
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
What's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdfWhat's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdf
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
@Call @Girls Thiruvananthapuram 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...
@Call @Girls Thiruvananthapuram  🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...@Call @Girls Thiruvananthapuram  🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...
@Call @Girls Thiruvananthapuram 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cu...
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 

CSS

  • 1. How CSS works Prepared By: Md. Sirajus Salayhin Assistant Programmer Nanosoft Email: [email_address] Web: http://nanoit.biz
  • 2. What is CSS C ascading  S tyle  S heets Contains the rules for the presentation of HTML. + = HTML CSS Web Page CSS was introduced to keep the presentation information separate from HTML markup (content).
  • 3. Before CSS Initially Designers used presentation tags like (FONT, B, BR, TABLE etc.) and spacers GIFs to control the design of web pages.
  • 4. Any modification in the design of websites was a very difficult and boring task , as it evolves manually editing every HTML page.
  • 5. Providing support for multiple browsers was a difficult task.
  • 6. CSS – brief history Style sheets have existed in one form or another since the beginnings of SGML in the 1970s. In 1996, CSS level 1 Recommendation was published in December. CSS level2 was published as a W3C Recommendation on May 12, 1998 CSS level3 is still under development.
  • 7. Sources of Styles Author (developer) Styles Inline Styles - As inline attribute “style” inside HTML tags <div style=“font-weight: bold;” >I am bold</div> Embedded Styles - As embedded style tag with in HTML document. <html> <head> <title>Welcome to Vendio!</title> <style> .footer { width:90%; } </style> ------- </html> Linked Styles - Inside separate files with .css extension <link rel=&quot;stylesheet&quot; href=“external.css&quot; type=&quot;text/css&quot; />
  • 8. Sources of Styles(contd.) User Style sheets This file contains the user created styles . [firefox profile folder]/ chrome/userContent-example.css is the current user’s style sheet file for the firefox. Browser default style sheet This file contains default styles for all users of a browser [firefox folder]/res/html.css is the default style sheet file for the firefox.
  • 9. Cascade The CSS cascade assigns a weight to each style rule. When several rules apply, the one with the greatest weight takes precedence. Order of preference for various styles: Default browser style sheet ( weakest ) User style sheet Author style sheet Author embedded styles Author inline styles ( strongest )
  • 10. CSS Selectors ID based ( #) HTML CSS <div id =“content”> # content { Text width: 200px; </div> } ID selectors should be used with single elements.
  • 11. Class based selector Class (.) HTML CSS <div class =“big”> . content { Text width: 200px; </div> } <div> <span class =“big”>some text </span> </div> Class based styles can be used by multiple HTML elements.
  • 12. Tag based selectors Tag (Tag name) HTML CSS < div > DIV { Text width: 200px; </div> } < div > SPAN { < span >some text </span> font-size:130%; </div> } < span >some other text </span>
  • 13. Grouping Multiple selectors can be grouped in a single style declaration by using , . H1 , P , .main { font-weight:bold; }
  • 14. Descendant selectors Descendant selectors are used to select elements that are descendants ( not necessarily children ) of another element in the document tree. HTML CSS < div class=“abc” > DIV.abc P { <div> font-weight:bold; < P > } Hello there! </p> </div> </div>
  • 15. Child selectors A child selector is used to select an element that is a direct child of another element (parent). Child selectors will not select all descendants, only direct children. HTML CSS <div > DIV.abc > P { < div class=“abc” > font-weight:bold; < P > } Hello there! </p> </div> </div>
  • 16. Universal selectors Universal selectors are used to select any element. *  { color: blue; }
  • 17. Adjacent sibling selectors Adjacent sibling selectors will select the sibling immediately following an element. DIV.abc + P { font-weight: bold; } will work for <div> < div class=“abc”>Message</div> < P >Hello there!</p> </div>
  • 18. Attribute selectors Attribute selectors selects elements based upon the attributes present in the HTML Tags and their value. IMG [src=&quot;small.gif&quot;]  { border: 1px solid #000; } will work for <img src=“small.gif” />
  • 19. CSS Pseudo-classes selector:pseudo-class { property: value } :link :visited } Link (A tag) related pseudo classes :hover :active :after :before :first-child :focus :first-letter :first-line :lang
  • 20. CSS Values Words: text-align: center ;. Numerical values: Numerical values are usually followed by a unit type. font-size:12 px ; 12 is the numerical value and px is the unit type pixels. Absolute Values – in, pc, px, cm, mm, pt Relative Values – em, ex, % Color values: color :#336699 or color#369.
  • 21. Categories of CSS properties Positioning and layout handling related. Background related properties. Font and text related Links related. Lists related. Table related.
  • 23. The Display Property Block Level elements , such as DIVs, paragraphs, headings, and lists, sit one above another when displayed in the browser. HTML <body> <div id=“div1”></div> <div id=“div2”></div> <div id=“div3”></div> </body> CSS #div1 { width:300px;background:yellow;} #div1 { width:300px;background:blue;} #div1 { width:300px;background:orange;}
  • 24. Inline Elements Inline elements such as a, span, and img, sit side by side when they are displayed in the browser and only appear on a new line if there is insufficient room on the previous one. <div id=&quot;row1&quot; > <span class=&quot;norm&quot;>This is small text and </span> <span class=&quot;big&quot;>this is big</span> <span class=&quot;italicText&quot;> I am Italic</span> </div> .norm { color : red ; } .big { color : blue ; font-weight : bold ; } .italicText { color : green ; font-style : italic ; } #row1 { padding :10px; border : solid 1px #000; }
  • 25. Display property none inline block list-item run-in compact marker table inline-table inline-block table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption
  • 26. Visibility Visible : The element is visible (default). Hidden : The element is invisible (but still takes up space) .big { visibility : hidden ; }
  • 27. z-index The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order. only works on positioned elements (position:absolute, position:relative, or position:fixed).
  • 28. Default page flow Always think of web page as 3D arrangement of different layers .
  • 29. Floating float : left , right , none ; A floated box is laid out according to the normal flow, then taken out of the flow and shifted to the left or right as far as possible. IMG { float : left ; }
  • 30. Floating multiple elements Floated boxes will move to the left or right until their outer edge touches the containing block edge or the outer edge of another float. <ul> <li>Home</li> <li>Products</li> <li>Services</li> <li>Contact Us</li> </ul> After applying LI { float:left; }
  • 31. Clearing Floats Clear:both ; Or <style type=&quot;text/css&quot;> .clearfix:after { content: &quot;.&quot;; display: block; height: 0; clear: both; visibility: hidden; } .clearfix {display: inline-block;} /* for IE/Mac */ </style> <!--[if IE]><style type=&quot;text/css&quot;> .clearfix { zoom: 1; display: block; } </style> <![endif]-->
  • 32. Positioning - static position: static ; (Default option) the element occurs in the normal flow (ignores any top, bottom, left, right, or z-index declarations)
  • 33. Positioning - relative position: relative ; Generates a relatively positioned element, positioned relative to its normal position , use bottom, right, top and left property to place element. Default flow of other elements don’t change.
  • 34. Positioning - absolute position: relative ; Generates an absolutely positioned element, positioned relative to the first parent element that has a position other than static (if none is found, relative to document’s BODY). use bottom, right, top and left property to place element
  • 35. Positioning - fixed position: relative ; Generates an absolutely positioned element, positioned relative to the browser window and don’t change even after page scroll . use bottom, right, top and left property to place element
  • 36. Inheritance Styles that relate to text and appearance are inherited by the descendant elements. Styles that relate to the appearance of boxes created by styling DIVs, paragraphs, and other elements, such as borders, padding, margins are not inherited .
  • 37.