SlideShare a Scribd company logo
1 of 15
How do speed up web pages? CSS & HTML tricks - Swati Arora
Some EASY tricks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CSS font shorthand rule When styling fonts with CSS you may be doing this: font-size: 1em; line-height: 1.5em; font-weight: bold; font-style: italic; font-varient: small-caps; font-family: verdana,serif font: 1em/1.5em bold italic small-caps verdana,serif NOTE: This CSS shorthand version will only work if you're specifying both the font-size and the font-family else the font-weight, font-style, or font-varient then these values will automatically default to a value of normal.
Two classes together <p class=&quot;text pad&quot;>...</p> Using these two classes together (separated by a space, not with a comma) means that the paragraph calls up the rules assigned to both  text and pad.  If any rules overlap between the two classes then the class which  is below the other in the CSS document will take precedence.
CSS Sprites BELOW #nav li a {background:none no-repeat left center} #nav li a.item1 {background-image:url('../img/image1.gif')} #nav li a:hover.item1 {background-image:url('../img/image1_over.gif')} #nav li a.item2 {background-image:url('../img/image2.gif')} #nav li a:hover.item2 {background-image:url('../img/image2_over.gif')} AFTER #nav li a {background-image:url('../img/image_nav.gif')} #nav li a.item1 {background-position:0px 0px} #nav li a:hover.item1 {background-position:0px -72px} #nav li a.item2 {background-position:0px -143px;} #nav li a:hover.item2 {background-position:0px -215px;}
CSS Sprites - Buttons HTML <div class=&quot;clearbutton&quot;> <a class=&quot;GlobalOrangeButton&quot; href=&quot;#&quot;><span>So Neat!</span></a> </div> CSS a.GlobalOrangeButton span { background: transparent url('images/button_left_orange.png') no-repeat 0 0; display: block; line-height: 22px; padding: 7px 0 5px 18px; color: #fff; } a.GlobalOrangeButton { background: transparent url('images/button_right_orange.png') no-repeat top right; display: block; float: left; height: 34px; margin-right: 6px; padding-right: 20px; text-decoration: none; font-family: Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; } a.GlobalOrangeButton:hover span { background-position: 0 -34px; color: #fff; } a.GlobalOrangeButton:hover { background-position: right -34px; }
!important ignored by IE Normally in CSS whichever rule is specified last takes precedence. However if you use  !important  after a command then this CSS command will take precedence regardless of what appears after it. This is true for all browsers except IE. An example of this would be: margin-top: 3.5em !important; margin-top: 2em So, the top margin will be set to 3.5em for all browsers except IE, which will have a top  margin of 2em. This can sometimes come in useful, especially when using relative margins  (such as in this example) as these can display slightly differently between IE and other  browsers.
Google Web Fonts ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Making the Web Beautiful!
Text Wrapping .truncate { width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } A long cold winter delayed the blossoming of the millions of cherry...
.transparent_class { /* IE 8 */ -ms-filter: &quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=50)&quot;; /* IE 5-7 */ filter: alpha(opacity=50); /* Netscape */ -moz-opacity: 0.5; /* Safari 1.x */ -khtml-opacity: 0.5; /* Good browsers */ opacity: 0.5; } Cross Browser Opacity
Intro to HTML 5
Benefits of HTML 5 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Intro to HTML 5 The new structural elements <header> <nav> <section> <article> <aside> <footer>
Lets check this
 

More Related Content

What's hot

ElggCamp Santiago - Dev Edition
ElggCamp Santiago - Dev EditionElggCamp Santiago - Dev Edition
ElggCamp Santiago - Dev EditionBrett Profitt
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 
Coder Presentation Boston
Coder Presentation BostonCoder Presentation Boston
Coder Presentation BostonDoug Green
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2RORLAB
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with CucumberBen Mabey
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationMasashi Shibata
 
Streamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web FrameworksStreamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web Frameworksguestf7bc30
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third PluginJustin Ryan
 
Joomla security nuggets
Joomla security nuggetsJoomla security nuggets
Joomla security nuggetsguestbd1cdca
 
Joomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design PresentationJoomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design PresentationChris Davenport
 
Joomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignJoomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignAndy Wallace
 
All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...Caelum
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 BoilerplateMichael Enslow
 
Introduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksIntroduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksGerald Krishnan
 
Widget Summit 2008
Widget Summit 2008Widget Summit 2008
Widget Summit 2008Volkan Unsal
 

What's hot (20)

ElggCamp Santiago - Dev Edition
ElggCamp Santiago - Dev EditionElggCamp Santiago - Dev Edition
ElggCamp Santiago - Dev Edition
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 
Coder Presentation Boston
Coder Presentation BostonCoder Presentation Boston
Coder Presentation Boston
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
 
WordPress and Ajax
WordPress and AjaxWordPress and Ajax
WordPress and Ajax
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
 
Streamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web FrameworksStreamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web Frameworks
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
Joomla security nuggets
Joomla security nuggetsJoomla security nuggets
Joomla security nuggets
 
Joomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design PresentationJoomla Day UK 2009 Template Design Presentation
Joomla Day UK 2009 Template Design Presentation
 
Joomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignJoomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template Design
 
All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 Boilerplate
 
Introduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksIntroduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC Frameworks
 
Widget Summit 2008
Widget Summit 2008Widget Summit 2008
Widget Summit 2008
 

Similar to How do speed up web pages? CSS & HTML Tricks

Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02Hatem Mahmoud
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglKilian Valkhof
 
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
 
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
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010WordPress Development Confoo 2010
WordPress Development Confoo 2010Brendan Sera-Shriar
 
HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptraghavanp4
 
Even faster web sites presentation 3
Even faster web sites presentation 3Even faster web sites presentation 3
Even faster web sites presentation 3Felipe Lavín
 
User Defined Characters Solution Proposal
User Defined Characters Solution ProposalUser Defined Characters Solution Proposal
User Defined Characters Solution ProposalJun Fujisawa
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from AustinLisa Adkins
 
Implementing @font-face
Implementing @font-faceImplementing @font-face
Implementing @font-faceAban Nesta
 
Svg Overview And Js Libraries
Svg Overview And Js LibrariesSvg Overview And Js Libraries
Svg Overview And Js Librariesseamusjr
 
Visualforce css developer guide(by forcetree.com)
Visualforce css developer guide(by forcetree.com)Visualforce css developer guide(by forcetree.com)
Visualforce css developer guide(by forcetree.com)Edwin Vijay R
 
Web 2.0 Lessonplan Day1
Web 2.0 Lessonplan Day1Web 2.0 Lessonplan Day1
Web 2.0 Lessonplan Day1Jesse Thomas
 

Similar to How do speed up web pages? CSS & HTML Tricks (20)

Html Expression Web
Html Expression WebHtml Expression Web
Html Expression Web
 
Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02
 
Html5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webglHtml5, css3, canvas, svg and webgl
Html5, css3, canvas, svg and webgl
 
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 Fundamentals
CSS FundamentalsCSS Fundamentals
CSS Fundamentals
 
Css
CssCss
Css
 
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
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010WordPress Development Confoo 2010
WordPress Development Confoo 2010
 
HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
Even faster web sites presentation 3
Even faster web sites presentation 3Even faster web sites presentation 3
Even faster web sites presentation 3
 
User Defined Characters Solution Proposal
User Defined Characters Solution ProposalUser Defined Characters Solution Proposal
User Defined Characters Solution Proposal
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from Austin
 
Css3 101
Css3 101Css3 101
Css3 101
 
Implementing @font-face
Implementing @font-faceImplementing @font-face
Implementing @font-face
 
Svg Overview And Js Libraries
Svg Overview And Js LibrariesSvg Overview And Js Libraries
Svg Overview And Js Libraries
 
Visualforce css developer guide(by forcetree.com)
Visualforce css developer guide(by forcetree.com)Visualforce css developer guide(by forcetree.com)
Visualforce css developer guide(by forcetree.com)
 
Web 2.0 Lessonplan Day1
Web 2.0 Lessonplan Day1Web 2.0 Lessonplan Day1
Web 2.0 Lessonplan Day1
 

More from Compare Infobase Limited

How to increase effective CTR, CPC and e CPM of website?
How to increase effective CTR, CPC and e CPM of website?How to increase effective CTR, CPC and e CPM of website?
How to increase effective CTR, CPC and e CPM of website?Compare Infobase Limited
 

More from Compare Infobase Limited (20)

Google +
Google +Google +
Google +
 
J Query
J QueryJ Query
J Query
 
Dos and Don't during Monsoon!
Dos and Don't during Monsoon!Dos and Don't during Monsoon!
Dos and Don't during Monsoon!
 
Intellectual Property Rights : A Primer
Intellectual Property Rights : A PrimerIntellectual Property Rights : A Primer
Intellectual Property Rights : A Primer
 
CIL initiative against Corruption
CIL initiative against CorruptionCIL initiative against Corruption
CIL initiative against Corruption
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
Arrays in PHP
Arrays in PHPArrays in PHP
Arrays in PHP
 
Storage and Storage Devices
Storage and Storage DevicesStorage and Storage Devices
Storage and Storage Devices
 
SQL Injection Attacks
SQL Injection AttacksSQL Injection Attacks
SQL Injection Attacks
 
World No Tobacco Day
World No Tobacco DayWorld No Tobacco Day
World No Tobacco Day
 
Tips for Effective Online Marketing
Tips for Effective Online Marketing Tips for Effective Online Marketing
Tips for Effective Online Marketing
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
 
Have a safe Summer!
Have a safe Summer!Have a safe Summer!
Have a safe Summer!
 
Introduction to Android Environment
Introduction to Android EnvironmentIntroduction to Android Environment
Introduction to Android Environment
 
MySQL Functions
MySQL FunctionsMySQL Functions
MySQL Functions
 
Software Development Life Cycle Part II
Software Development Life Cycle Part IISoftware Development Life Cycle Part II
Software Development Life Cycle Part II
 
Excel with Excel
Excel with ExcelExcel with Excel
Excel with Excel
 
Software Development Life Cycle (SDLC)
Software Development Life Cycle (SDLC)Software Development Life Cycle (SDLC)
Software Development Life Cycle (SDLC)
 
How to increase effective CTR, CPC and e CPM of website?
How to increase effective CTR, CPC and e CPM of website?How to increase effective CTR, CPC and e CPM of website?
How to increase effective CTR, CPC and e CPM of website?
 
Social Media Integration
Social Media IntegrationSocial Media Integration
Social Media Integration
 

How do speed up web pages? CSS & HTML Tricks

  • 1. How do speed up web pages? CSS & HTML tricks - Swati Arora
  • 2.
  • 3. CSS font shorthand rule When styling fonts with CSS you may be doing this: font-size: 1em; line-height: 1.5em; font-weight: bold; font-style: italic; font-varient: small-caps; font-family: verdana,serif font: 1em/1.5em bold italic small-caps verdana,serif NOTE: This CSS shorthand version will only work if you're specifying both the font-size and the font-family else the font-weight, font-style, or font-varient then these values will automatically default to a value of normal.
  • 4. Two classes together <p class=&quot;text pad&quot;>...</p> Using these two classes together (separated by a space, not with a comma) means that the paragraph calls up the rules assigned to both text and pad. If any rules overlap between the two classes then the class which is below the other in the CSS document will take precedence.
  • 5. CSS Sprites BELOW #nav li a {background:none no-repeat left center} #nav li a.item1 {background-image:url('../img/image1.gif')} #nav li a:hover.item1 {background-image:url('../img/image1_over.gif')} #nav li a.item2 {background-image:url('../img/image2.gif')} #nav li a:hover.item2 {background-image:url('../img/image2_over.gif')} AFTER #nav li a {background-image:url('../img/image_nav.gif')} #nav li a.item1 {background-position:0px 0px} #nav li a:hover.item1 {background-position:0px -72px} #nav li a.item2 {background-position:0px -143px;} #nav li a:hover.item2 {background-position:0px -215px;}
  • 6. CSS Sprites - Buttons HTML <div class=&quot;clearbutton&quot;> <a class=&quot;GlobalOrangeButton&quot; href=&quot;#&quot;><span>So Neat!</span></a> </div> CSS a.GlobalOrangeButton span { background: transparent url('images/button_left_orange.png') no-repeat 0 0; display: block; line-height: 22px; padding: 7px 0 5px 18px; color: #fff; } a.GlobalOrangeButton { background: transparent url('images/button_right_orange.png') no-repeat top right; display: block; float: left; height: 34px; margin-right: 6px; padding-right: 20px; text-decoration: none; font-family: Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; } a.GlobalOrangeButton:hover span { background-position: 0 -34px; color: #fff; } a.GlobalOrangeButton:hover { background-position: right -34px; }
  • 7. !important ignored by IE Normally in CSS whichever rule is specified last takes precedence. However if you use !important after a command then this CSS command will take precedence regardless of what appears after it. This is true for all browsers except IE. An example of this would be: margin-top: 3.5em !important; margin-top: 2em So, the top margin will be set to 3.5em for all browsers except IE, which will have a top margin of 2em. This can sometimes come in useful, especially when using relative margins (such as in this example) as these can display slightly differently between IE and other browsers.
  • 8.
  • 9. Text Wrapping .truncate { width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } A long cold winter delayed the blossoming of the millions of cherry...
  • 10. .transparent_class { /* IE 8 */ -ms-filter: &quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=50)&quot;; /* IE 5-7 */ filter: alpha(opacity=50); /* Netscape */ -moz-opacity: 0.5; /* Safari 1.x */ -khtml-opacity: 0.5; /* Good browsers */ opacity: 0.5; } Cross Browser Opacity
  • 12.
  • 13. Intro to HTML 5 The new structural elements <header> <nav> <section> <article> <aside> <footer>
  • 15.