Movatterモバイル変換


[0]ホーム

URL:


Uploaded bysachin9737
PPT, PDF576 views

Css Best Practices

The document discusses CSS best practices for web development. It recommends using a CSS reset to eliminate browser inconsistencies, organizing stylesheets in a logical structure, writing readable CSS code with proper formatting and indentation, keeping CSS consistent through naming conventions, combining similar CSS elements, using multiple classes, using CSS shorthand where possible, commenting CSS code, and avoiding inline styles. It also recommends validating CSS code to quickly spot errors.

Embed presentation

Downloaded 21 times
CSS BEST PRACTICES By Sachin Chaudhari – Zensar Technologies
Introduction This Presentation is consolidation of the CSS (Cascading Style Sheet) best practices during web development.
Advantages of CSS CSS helps to reduce html code Pages load faster Easy for maintenance  Saves time
Types of CSS Inline styles Inline styles are styles that are written directly in the tag on the document. Inline styles affect only the tag they are applied to. <a href=&quot;&quot; style=&quot;text-decoration: none;&quot;> Embedded/Internal styles Embedded or Internal styles are styles that are embedded in the head of the document. Embedded styles affect only the tags on the page they are embedded in. <style type=&quot;text/css“> p { color: #00f; } </style> External styles External styles are styles that are written in a separate document and then attached to various documents. External style sheets can affect any document they are attached to. <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;styles.css&quot; />
CSS Best Practices Use a Reset Resets essentially eliminate browser inconsistencies such as heights, font sizes, margins, headings, etc. The reset allows your layout look consistent in all browsers.  Example: body, h1,h2,h3,h4,h5,h6,form,fieldset,input,textarea,p {  margin:0; padding:0; } table { border-collapse:collapse; border-spacing:0; } fieldset,img {  border:0; } ol,ul { list-style:none; }
CSS Best Practices Organize the Stylesheet with a logical Structure lay your stylesheet out in a way that allows you to quickly find parts of your code.  So, an example stylesheet might be ordered like this: Generic classes (body, a, p, h1, etc.) /****** header *********/ styles goes here... /****** header End*********/ /****** main content *********/ styles goes here... /****** main content End*********/ /****** footer *********/ styles go here... /****** footer End *********/ /****** common*********/ styles go here... /****** common End *********/
CSS Best Practices Make it Readable The readability of your CSS is incredibly important, though most people overlook why it's important. Great readability of your CSS makes it much easier to maintain in the future, as you'll be able to find elements quicker.  Also, you'll never know who might need to look at your code later on.  All on one line .content { background: red; padding: 2em; border: 1px solid black; } on different line .content {  background: red;  padding: 2em;  border: 1px solid black;  }
CSS Best Practices Keep it Consistent Along the lines of keeping your code readable is making sure that the CSS is consistent.  develop your own &quot;sub-language&quot; of CSS that allows you to quickly name things.  There are certain classes that I create in nearly every application, and I use the same name each time. For example, I use &quot;.dbfl&quot; to float divs to the left. Good Example .dbfl { display:block;  float:left; } .dbfr { display:block;  float:right; } Bad Example .dbfl { display:block;  float:left; } .dbfr { float:right; display:block; }
CSS Best Practices Combine Elements Elements in a stylesheet sometimes share properties.  Instead of re-writing the same properties just combine them. For example, your h1, h2, and h3 elements might all share the same font and color: h1, h2, h3 {font-family: tahoma, color: #333}
CSS Best Practices Use Multiple Classes Sometimes it's beneficial to add multiple classes to an element.  Let's say that you have a <div> having class &quot;box&quot; which defines color and font properties .  <div class=&quot;box&quot;></div> Now you want to float it right, and you've already got a class . right  in your CSS that floats everything to the right. You can simply add an extra class in the declaration, like so: <div class=&quot;box right&quot;></div>
CSS Best Practices Use Shorthand while declarations Comment your CSS  Avoid Using Inline Styles
CSS Best Practices Validate your CSS Validating your CSS does more than give a sense of pride:  it helps you quickly spot errors in your code. Validation Service http://jigsaw.w3.org/css-validator/
THANK YOU

Recommended

PPTX
Introduction to CSS
PPTX
Css intro
ODP
Cascading Style Sheets - Part 02
PPTX
Cascading style sheets (CSS)
PPTX
Cascading Style Sheet (CSS)
PPT
Cascading Style Sheets
PDF
Introduction to css
PPT
ODP
Introduction to css & its attributes with syntax
PPSX
Introduction to css
PPTX
Css introduction
PPTX
Week 12 CSS - Review from last week
PPT
PPTX
Cascading Style Sheets (CSS)
KEY
Web Design, Lesson Plan: Classes and IDs
PDF
Html css
PPT
Html Expression Web
PPT
INFO3775 Chapter 2 Part 2
PPT
Week3 css
PPTX
CSS introduction
PPT
CSS Introduction
PDF
Search For Buzz Sc Bilbao 2010, Massimo Burgio
DOCX
Atlassian confluence: how to change font size
PPTX
Flash与增强型web应用
PPTX
Extending Slate Queries & Reports with JSON & JQUERY
PDF
Python profiling
PDF
Getting Started in the Mobile Web
PPTX
Android App Development (Basics)

More Related Content

PPTX
Introduction to CSS
PPTX
Css intro
ODP
Cascading Style Sheets - Part 02
PPTX
Cascading style sheets (CSS)
PPTX
Cascading Style Sheet (CSS)
PPT
Cascading Style Sheets
PDF
Introduction to css
Introduction to CSS
Css intro
Cascading Style Sheets - Part 02
Cascading style sheets (CSS)
Cascading Style Sheet (CSS)
Cascading Style Sheets
Introduction to css

What's hot

PPT
ODP
Introduction to css & its attributes with syntax
PPSX
Introduction to css
PPTX
Css introduction
PPTX
Week 12 CSS - Review from last week
PPT
PPTX
Cascading Style Sheets (CSS)
KEY
Web Design, Lesson Plan: Classes and IDs
PDF
Html css
PPT
Html Expression Web
PPT
INFO3775 Chapter 2 Part 2
PPT
Week3 css
PPTX
CSS introduction
PPT
CSS Introduction
Introduction to css & its attributes with syntax
Introduction to css
Css introduction
Week 12 CSS - Review from last week
Cascading Style Sheets (CSS)
Web Design, Lesson Plan: Classes and IDs
Html css
Html Expression Web
INFO3775 Chapter 2 Part 2
Week3 css
CSS introduction
CSS Introduction

Viewers also liked

PDF
Search For Buzz Sc Bilbao 2010, Massimo Burgio
DOCX
Atlassian confluence: how to change font size
PPTX
Flash与增强型web应用
PPTX
Extending Slate Queries & Reports with JSON & JQUERY
PDF
Python profiling
PDF
Getting Started in the Mobile Web
PPTX
Android App Development (Basics)
KEY
从浏览器渲染看标准的重要性
PPTX
这年头,你只需要懂Node webkit
 
PDF
Testing Content Effectiveness - Penn State 2015
PDF
Not my type font
PDF
Lawless font
Search For Buzz Sc Bilbao 2010, Massimo Burgio
Atlassian confluence: how to change font size
Flash与增强型web应用
Extending Slate Queries & Reports with JSON & JQUERY
Python profiling
Getting Started in the Mobile Web
Android App Development (Basics)
从浏览器渲染看标准的重要性
这年头,你只需要懂Node webkit
 
Testing Content Effectiveness - Penn State 2015
Not my type font
Lawless font

Similar to Css Best Practices

PDF
Structuring your CSS for maintainability: rules and guile lines to write CSS
PPT
Html & CSS - Best practices 2-hour-workshop
PDF
Advanced CSS Troubleshooting & Efficiency
PDF
Advanced CSS Troubleshooting
PPT
CSS Basics
PDF
Maintainable CSS
PDF
6 Steps to Make Your CSS Code More Maintainable
PPT
How Cascading Style Sheets (CSS) Works
PPT
CSS Best practices
PPT
Modern front end development
PDF
CSS Best practice
PPT
ODP
HTML5, CSS, JavaScript Style guide and coding conventions
PPT
Make Css easy(part:2) : easy tips for css(part:2)
PPT
Basics Of Css And Some Common Mistakes
PDF
Efficient, maintainable CSS
PDF
Introduction to Frontend Development - Session 2 - CSS Fundamentals
PPT
CSS Methodology
Structuring your CSS for maintainability: rules and guile lines to write CSS
Html & CSS - Best practices 2-hour-workshop
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting
CSS Basics
Maintainable CSS
6 Steps to Make Your CSS Code More Maintainable
How Cascading Style Sheets (CSS) Works
CSS Best practices
Modern front end development
CSS Best practice
HTML5, CSS, JavaScript Style guide and coding conventions
Make Css easy(part:2) : easy tips for css(part:2)
Basics Of Css And Some Common Mistakes
Efficient, maintainable CSS
Introduction to Frontend Development - Session 2 - CSS Fundamentals
CSS Methodology

Recently uploaded

PPTX
Moho Pro 14.4 Crack for MacOS Works Until 2050 [Latest] pptx
PPTX
AnyTrans for iOS 8.9.14.20251127 With Crack for MacOS [Latest] pptx
PPTX
Optimization of Lightweight Concrete Using Vermiculite, Silica Fume & Naphtha...
PPTX
WinRAR Crack 7.13 Final Mac Keygen 2026 Download [Latest] Software.pptx
PDF
Criminal record certificate: no registration - College graduation Certified b...
PDF
WEDDING STYLING / INTERIOR DESIGN PORTFOLIO 2025 SK
PPTX
CH 12 FASHION DESIGN AND MERCHANDIZING.pptx
PPTX
Presentation - The First Christmas Story.pptx
PDF
International Journal of Information Technology, Modeling and Computing (IJITMC)
PDF
PX vs EM vs REM - Battle of CSS Units - Which to Use When?
PPTX
Audio Hijack 4.5.6 Crack Plus License Key Full Activated Software.pptx
PPTX
coverpage for acr on professional code of ethics.pptx
PPTX
Artificial Intelligence basic notes for engineering.pptx
PPTX
Construction area photographs site visit
PPTX
THEORY OF ARCHITECTURE - LECTURE NOTES - SYMBOLISM
PDF
Advanced Computational Intelligence: An International Journal (ACII)
PPTX
Driver Easy Pro Key 7.1.0.2641 Full Mac Crack Free Activated Download [2026]....
PPTX
Soundtoys Mac v5.5.5.0 Crack for MacOS Full Version [Latest] pptx
PPTX
NETWORKING SECURITY PRESENTATION FROM ALI).pptx
PPTX
PowerISO 9.2 Mac Crack + Serial Key Free Download 2026 [Latest] Software.pptx
Moho Pro 14.4 Crack for MacOS Works Until 2050 [Latest] pptx
AnyTrans for iOS 8.9.14.20251127 With Crack for MacOS [Latest] pptx
Optimization of Lightweight Concrete Using Vermiculite, Silica Fume & Naphtha...
WinRAR Crack 7.13 Final Mac Keygen 2026 Download [Latest] Software.pptx
Criminal record certificate: no registration - College graduation Certified b...
WEDDING STYLING / INTERIOR DESIGN PORTFOLIO 2025 SK
CH 12 FASHION DESIGN AND MERCHANDIZING.pptx
Presentation - The First Christmas Story.pptx
International Journal of Information Technology, Modeling and Computing (IJITMC)
PX vs EM vs REM - Battle of CSS Units - Which to Use When?
Audio Hijack 4.5.6 Crack Plus License Key Full Activated Software.pptx
coverpage for acr on professional code of ethics.pptx
Artificial Intelligence basic notes for engineering.pptx
Construction area photographs site visit
THEORY OF ARCHITECTURE - LECTURE NOTES - SYMBOLISM
Advanced Computational Intelligence: An International Journal (ACII)
Driver Easy Pro Key 7.1.0.2641 Full Mac Crack Free Activated Download [2026]....
Soundtoys Mac v5.5.5.0 Crack for MacOS Full Version [Latest] pptx
NETWORKING SECURITY PRESENTATION FROM ALI).pptx
PowerISO 9.2 Mac Crack + Serial Key Free Download 2026 [Latest] Software.pptx

Css Best Practices

  • 1.
    CSS BEST PRACTICESBy Sachin Chaudhari – Zensar Technologies
  • 2.
    Introduction This Presentationis consolidation of the CSS (Cascading Style Sheet) best practices during web development.
  • 3.
    Advantages of CSSCSS helps to reduce html code Pages load faster Easy for maintenance Saves time
  • 4.
    Types of CSSInline styles Inline styles are styles that are written directly in the tag on the document. Inline styles affect only the tag they are applied to. <a href=&quot;&quot; style=&quot;text-decoration: none;&quot;> Embedded/Internal styles Embedded or Internal styles are styles that are embedded in the head of the document. Embedded styles affect only the tags on the page they are embedded in. <style type=&quot;text/css“> p { color: #00f; } </style> External styles External styles are styles that are written in a separate document and then attached to various documents. External style sheets can affect any document they are attached to. <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;styles.css&quot; />
  • 5.
    CSS Best PracticesUse a Reset Resets essentially eliminate browser inconsistencies such as heights, font sizes, margins, headings, etc. The reset allows your layout look consistent in all browsers. Example: body, h1,h2,h3,h4,h5,h6,form,fieldset,input,textarea,p { margin:0; padding:0; } table { border-collapse:collapse; border-spacing:0; } fieldset,img { border:0; } ol,ul { list-style:none; }
  • 6.
    CSS Best PracticesOrganize the Stylesheet with a logical Structure lay your stylesheet out in a way that allows you to quickly find parts of your code. So, an example stylesheet might be ordered like this: Generic classes (body, a, p, h1, etc.) /****** header *********/ styles goes here... /****** header End*********/ /****** main content *********/ styles goes here... /****** main content End*********/ /****** footer *********/ styles go here... /****** footer End *********/ /****** common*********/ styles go here... /****** common End *********/
  • 7.
    CSS Best PracticesMake it Readable The readability of your CSS is incredibly important, though most people overlook why it's important. Great readability of your CSS makes it much easier to maintain in the future, as you'll be able to find elements quicker. Also, you'll never know who might need to look at your code later on. All on one line .content { background: red; padding: 2em; border: 1px solid black; } on different line .content { background: red; padding: 2em; border: 1px solid black; }
  • 8.
    CSS Best PracticesKeep it Consistent Along the lines of keeping your code readable is making sure that the CSS is consistent. develop your own &quot;sub-language&quot; of CSS that allows you to quickly name things. There are certain classes that I create in nearly every application, and I use the same name each time. For example, I use &quot;.dbfl&quot; to float divs to the left. Good Example .dbfl { display:block; float:left; } .dbfr { display:block; float:right; } Bad Example .dbfl { display:block; float:left; } .dbfr { float:right; display:block; }
  • 9.
    CSS Best PracticesCombine Elements Elements in a stylesheet sometimes share properties. Instead of re-writing the same properties just combine them. For example, your h1, h2, and h3 elements might all share the same font and color: h1, h2, h3 {font-family: tahoma, color: #333}
  • 10.
    CSS Best PracticesUse Multiple Classes Sometimes it's beneficial to add multiple classes to an element. Let's say that you have a <div> having class &quot;box&quot; which defines color and font properties . <div class=&quot;box&quot;></div> Now you want to float it right, and you've already got a class . right in your CSS that floats everything to the right. You can simply add an extra class in the declaration, like so: <div class=&quot;box right&quot;></div>
  • 11.
    CSS Best PracticesUse Shorthand while declarations Comment your CSS Avoid Using Inline Styles
  • 12.
    CSS Best PracticesValidate your CSS Validating your CSS does more than give a sense of pride: it helps you quickly spot errors in your code. Validation Service http://jigsaw.w3.org/css-validator/
  • 13.

[8]ページ先頭

©2009-2025 Movatter.jp