SlideShare ist ein Scribd-Unternehmen logo
1 von 32
CSS Advanced – Session 4 Ramkumar Lakshminarayanan ramkumar [at] rajaramsystems [dot] com
CSS Align ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Center Aligning Using the margin Property ,[object Object],[object Object],[object Object]
Tip:  Aligning has no effect if the width is 100%. Example Source Example .center { margin-left:auto; margin-right:auto; width:70%; background-color:#b0e0e6; }
Left and Right Aligning Using the position Property ,[object Object],Note:  Absolute positioned elements are removed from the normal flow, and can overlap elements. Example Source Example .right { position:absolute; right:0px; width:300px; background-color:#b0e0e6; }
Crossbrowser Compatibility Issues ,[object Object],[object Object]
Example Source  Example body { margin:0; padding:0; } .container { position:relative; width:100%; } .right { position:absolute; right:0px; width:300px; background-color:#b0e0e6; }
Left and Right Aligning Using the float Property ,[object Object],Example Source Example .right { float:right; width:300px; background-color:#b0e0e6; }
Crossbrowser Compatibility Issues ,[object Object],[object Object]
Example Source Example body { margin:0; padding:0; } .right { float:right; width:300px; background-color:#b0e0e6; }
CSS Pseudo-classes ,[object Object],[object Object],[object Object],[object Object],selector:pseudo-class {property:value;} selector.class:pseudo-class {property:value;}
Anchor Pseudo-classes ,[object Object],Note:  a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!! Note:  a:active MUST come after a:hover in the CSS definition in order to be effective!! Note:  Pseudo-class names are not case-sensitive. Example Source Example a:link {color:#FF0000;}      /* unvisited link */ a:visited {color:#00FF00;}  /* visited link */ a:hover {color:#FF00FF;}  /* mouse over link */ a:active {color:#0000FF;}  /* selected link */
Pseudo-classes and CSS Classes ,[object Object],[object Object],a.red:visited {color:#FF0000;} <a class=&quot;red&quot; href=&quot;css_syntax.asp&quot;>CSS Syntax</a>
[object Object],[object Object],[object Object]
Match the first <p> element ,[object Object]
Example Source Example <html> <head> <style type=&quot;text/css&quot;> p:first-child { color:blue; }  </style> </head> <body> <p>I am a strong man.</p> <p>I am a strong man.</p> </body> </html>
Match the first <i> element in all <p> elements ,[object Object],Example Source Example <html> <head> <style type=&quot;text/css&quot;> p > i:first-child { font-weight:bold; }  </style> </head> <body> <p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p> <p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p> </body> </html>
Match all <i> elements in all first child <p> elements ,[object Object],Example Source Example <html> <head> <style type=&quot;text/css&quot;> p:first-child i { color:blue; }  </style> </head> <body> <p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p> <p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p> </body> </html>
[object Object],[object Object],[object Object],[object Object]
Example Source Example <html> <head> <style type=&quot;text/css&quot;> q:lang(no) {quotes: &quot;~&quot; &quot;~&quot;;} </style> </head> <body> <p>Some text <q lang=&quot;no&quot;>A quote in a paragraph</q> Some text.</p> </body> </html>
All CSS Pseudo Classes/Elements Selector Example Example description :link a:link Selects all unvisited links :visited a:visited Selects all visited links :active a:active Selects the active link :hover a:hover Selects links on mouse over :focus input:focus Selects the input element which has focus :first-letter p:first-letter Selects the first letter of every <p> element :first-line p:first-line Selects the first line of every <p> element :first-child p:first-child Selects every <p> elements that is the first child of its parent :before p:before Insert content before every <p> element :after p:after Insert content after every <p> element :lang( language ) p:lang(it) Selects every <p> element with a lang attribute value starting with &quot;it&quot;
CSS Pseudo-elements ,[object Object],[object Object],[object Object],[object Object],selector:pseudo-element {property:value;} selector.class:pseudo-element {property:value;}
The :first-line Pseudo-element ,[object Object],[object Object],Example Source Example p:first-line  { color:#ff0000; font-variant:small-caps; }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The :first-letter Pseudo-element ,[object Object],Example Source Example p:first-letter  { color:#ff0000; font-size:xx-large; }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],text-decoration vertical-align (only if &quot;float&quot; is &quot;none&quot;) text-transform line-height float clear
Pseudo-elements and CSS Classes ,[object Object],[object Object],p.article:first-letter {color:#ff0000;} <p class=&quot;article&quot;>A paragraph in an article</p>
Multiple Pseudo-elements ,[object Object],[object Object]
Example Source Example p:first-letter { color:#ff0000; font-size:xx-large; } p:first-line  { color:#0000ff; font-variant:small-caps; }
CSS - The :before Pseudo-element ,[object Object],[object Object],Example Source Example h1:before  { content:url(smiley.gif); }
CSS - The :after Pseudo-element ,[object Object],[object Object],Example Source Example h1:after { content:url(smiley.gif); }
All CSS Pseudo Classes/Elements Selector Example Example description :link a:link Selects all unvisited links :visited a:visited Selects all visited links :active a:active Selects the active link :hover a:hover Selects links on mouse over :focus input:focus Selects the input element which has focus :first-letter p:first-letter Selects the first letter of every <p> element :first-line p:first-line Selects the first line of every <p> element :first-child p:first-child Selects every <p> elements that is the first child of its parent :before p:before Insert content before every <p> element :after p:after Insert content after every <p> element :lang( language ) p:lang(it) Selects every <p> element with a lang attribute value starting with &quot;it&quot;

Weitere ähnliche Inhalte

Was ist angesagt?

Semantically Correct And Standards Compliance Html
Semantically Correct And Standards Compliance HtmlSemantically Correct And Standards Compliance Html
Semantically Correct And Standards Compliance Htmlsanjay2211
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1Sanjeev Kumar
 
Quick Referance to WML
Quick Referance to WMLQuick Referance to WML
Quick Referance to WMLNitin Saswade
 
Web publishing and XHTML
Web publishing and XHTMLWeb publishing and XHTML
Web publishing and XHTMLbjornh
 
The Basics of (X)HTML Tags
The Basics of (X)HTML TagsThe Basics of (X)HTML Tags
The Basics of (X)HTML TagsLearningNerd
 
Html, xml and java script
Html, xml and java scriptHtml, xml and java script
Html, xml and java scriptRajeev Uppala
 
Michael(tm) Smith ED09 presentation
Michael(tm) Smith ED09 presentationMichael(tm) Smith ED09 presentation
Michael(tm) Smith ED09 presentationMichael(tm) Smith
 
Html Presentation Of Web Page Making
Html Presentation Of Web Page MakingHtml Presentation Of Web Page Making
Html Presentation Of Web Page MakingSandeep Supal
 
Intro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 SlidesIntro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 SlidesHeather Rock
 
Html character entities
Html character entitiesHtml character entities
Html character entitiesnobel mujuji
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS Dave Kelly
 

Was ist angesagt? (19)

Semantically Correct And Standards Compliance Html
Semantically Correct And Standards Compliance HtmlSemantically Correct And Standards Compliance Html
Semantically Correct And Standards Compliance Html
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1
 
CSS
CSSCSS
CSS
 
Html
HtmlHtml
Html
 
Quick Referance to WML
Quick Referance to WMLQuick Referance to WML
Quick Referance to WML
 
Web publishing and XHTML
Web publishing and XHTMLWeb publishing and XHTML
Web publishing and XHTML
 
Html entities
Html entitiesHtml entities
Html entities
 
Basic HTML
Basic HTMLBasic HTML
Basic HTML
 
The Basics of (X)HTML Tags
The Basics of (X)HTML TagsThe Basics of (X)HTML Tags
The Basics of (X)HTML Tags
 
Html, xml and java script
Html, xml and java scriptHtml, xml and java script
Html, xml and java script
 
Html
HtmlHtml
Html
 
Michael(tm) Smith ED09 presentation
Michael(tm) Smith ED09 presentationMichael(tm) Smith ED09 presentation
Michael(tm) Smith ED09 presentation
 
Html Presentation Of Web Page Making
Html Presentation Of Web Page MakingHtml Presentation Of Web Page Making
Html Presentation Of Web Page Making
 
Intro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 SlidesIntro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 Slides
 
Html character entities
Html character entitiesHtml character entities
Html character entities
 
Css
CssCss
Css
 
Html tag
Html tagHtml tag
Html tag
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 
Htmltag.ppt
Htmltag.pptHtmltag.ppt
Htmltag.ppt
 

Andere mochten auch (6)

Amazon web services session 4
Amazon web services   session 4Amazon web services   session 4
Amazon web services session 4
 
Android action bar and notifications-chapter16
Android action bar and notifications-chapter16Android action bar and notifications-chapter16
Android action bar and notifications-chapter16
 
Web technology today
Web technology todayWeb technology today
Web technology today
 
Android canvas-chapter20
Android canvas-chapter20Android canvas-chapter20
Android canvas-chapter20
 
Discovering the value of the cloud for the business
Discovering the value of the cloud for the business Discovering the value of the cloud for the business
Discovering the value of the cloud for the business
 
Spc Ardmona
Spc ArdmonaSpc Ardmona
Spc Ardmona
 

Ähnlich wie Css advanced – session 5

Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Hatem Mahmoud
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet pptabhilashagupta
 
Stylesheets for Online Help - Scott DeLoach, ClickStart
Stylesheets for Online Help - Scott DeLoach, ClickStartStylesheets for Online Help - Scott DeLoach, ClickStart
Stylesheets for Online Help - Scott DeLoach, ClickStartScott DeLoach
 
Xhtml Part1
Xhtml Part1Xhtml Part1
Xhtml Part1nleesite
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7phuphax
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from AustinLisa Adkins
 
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 Jqueryvaluebound
 
Flex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 FinalFlex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 Finalematrix
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to cssBulldogs83
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to cssBulldogs83
 
Master pages ppt
Master pages pptMaster pages ppt
Master pages pptIblesoft
 

Ähnlich wie Css advanced – session 5 (20)

Css Ppt
Css PptCss Ppt
Css Ppt
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
Web Designing
Web DesigningWeb Designing
Web Designing
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
Css advanced – session 4
Css advanced – session 4Css advanced – session 4
Css advanced – session 4
 
Stylesheets for Online Help - Scott DeLoach, ClickStart
Stylesheets for Online Help - Scott DeLoach, ClickStartStylesheets for Online Help - Scott DeLoach, ClickStart
Stylesheets for Online Help - Scott DeLoach, ClickStart
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
Xhtml Part1
Xhtml Part1Xhtml Part1
Xhtml Part1
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
HTML
HTMLHTML
HTML
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from Austin
 
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
 
Flex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 FinalFlex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 Final
 
Markup Documents
Markup DocumentsMarkup Documents
Markup Documents
 
CSS
CSSCSS
CSS
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
Diva
DivaDiva
Diva
 
Master pages ppt
Master pages pptMaster pages ppt
Master pages ppt
 

Mehr von Dr. Ramkumar Lakshminarayanan

Mehr von Dr. Ramkumar Lakshminarayanan (20)

IT security awareness
IT security awarenessIT security awareness
IT security awareness
 
Basics of IT security
Basics of IT securityBasics of IT security
Basics of IT security
 
IT Security Awareness Posters
IT Security Awareness PostersIT Security Awareness Posters
IT Security Awareness Posters
 
Normalisation revision
Normalisation revisionNormalisation revision
Normalisation revision
 
Windows mobile programming
Windows mobile programmingWindows mobile programming
Windows mobile programming
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Phonegap for Android
Phonegap for AndroidPhonegap for Android
Phonegap for Android
 
Create and Sell Android App (in tamil)
Create and Sell Android App (in tamil)Create and Sell Android App (in tamil)
Create and Sell Android App (in tamil)
 
Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)
 
Android Tips (Tamil)
Android Tips (Tamil)Android Tips (Tamil)
Android Tips (Tamil)
 
Android Animation (in tamil)
Android Animation (in tamil)Android Animation (in tamil)
Android Animation (in tamil)
 
Creating List in Android App (in tamil)
Creating List in Android App (in tamil)Creating List in Android App (in tamil)
Creating List in Android App (in tamil)
 
Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)
 
Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)
 
Rating Bar in Android Example
Rating Bar in Android ExampleRating Bar in Android Example
Rating Bar in Android Example
 
Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)
 
Create Android App using web view (in tamil)
Create Android App using web view (in tamil)Create Android App using web view (in tamil)
Create Android App using web view (in tamil)
 
Hardware Interface in Android (in tamil)
Hardware Interface in Android (in tamil)Hardware Interface in Android (in tamil)
Hardware Interface in Android (in tamil)
 
GPS in Android (in tamil)
GPS in Android (in tamil)GPS in Android (in tamil)
GPS in Android (in tamil)
 

Css advanced – session 5

  • 1. CSS Advanced – Session 4 Ramkumar Lakshminarayanan ramkumar [at] rajaramsystems [dot] com
  • 2.
  • 3.
  • 4. Tip:  Aligning has no effect if the width is 100%. Example Source Example .center { margin-left:auto; margin-right:auto; width:70%; background-color:#b0e0e6; }
  • 5.
  • 6.
  • 7. Example Source Example body { margin:0; padding:0; } .container { position:relative; width:100%; } .right { position:absolute; right:0px; width:300px; background-color:#b0e0e6; }
  • 8.
  • 9.
  • 10. Example Source Example body { margin:0; padding:0; } .right { float:right; width:300px; background-color:#b0e0e6; }
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. Example Source Example <html> <head> <style type=&quot;text/css&quot;> p:first-child { color:blue; }  </style> </head> <body> <p>I am a strong man.</p> <p>I am a strong man.</p> </body> </html>
  • 17.
  • 18.
  • 19.
  • 20. Example Source Example <html> <head> <style type=&quot;text/css&quot;> q:lang(no) {quotes: &quot;~&quot; &quot;~&quot;;} </style> </head> <body> <p>Some text <q lang=&quot;no&quot;>A quote in a paragraph</q> Some text.</p> </body> </html>
  • 21. All CSS Pseudo Classes/Elements Selector Example Example description :link a:link Selects all unvisited links :visited a:visited Selects all visited links :active a:active Selects the active link :hover a:hover Selects links on mouse over :focus input:focus Selects the input element which has focus :first-letter p:first-letter Selects the first letter of every <p> element :first-line p:first-line Selects the first line of every <p> element :first-child p:first-child Selects every <p> elements that is the first child of its parent :before p:before Insert content before every <p> element :after p:after Insert content after every <p> element :lang( language ) p:lang(it) Selects every <p> element with a lang attribute value starting with &quot;it&quot;
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. Example Source Example p:first-letter { color:#ff0000; font-size:xx-large; } p:first-line  { color:#0000ff; font-variant:small-caps; }
  • 30.
  • 31.
  • 32. All CSS Pseudo Classes/Elements Selector Example Example description :link a:link Selects all unvisited links :visited a:visited Selects all visited links :active a:active Selects the active link :hover a:hover Selects links on mouse over :focus input:focus Selects the input element which has focus :first-letter p:first-letter Selects the first letter of every <p> element :first-line p:first-line Selects the first line of every <p> element :first-child p:first-child Selects every <p> elements that is the first child of its parent :before p:before Insert content before every <p> element :after p:after Insert content after every <p> element :lang( language ) p:lang(it) Selects every <p> element with a lang attribute value starting with &quot;it&quot;