1 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
Coding Standards
1.Comments on Code
Commented on Markup
<!-- header -->
Text information is separated from the tag by a “space ”. No additional symbols are
required.
This form is incorrect:
<!--  header ///// -->
<!-- *** header *** -->
You should comment:
1. main markup blocks (header, footer etc.)
2. main semantic blocks and elements (logo, navigation, breadcrumbs, article
etc.}
3. main functional blocks and elements (sub-navigation, popup, search contact
form etc.}
If it is impossible to find a semantic title, you can use a block heading or class as a title:
<!-- welcome block -->
or
<!-- block title -->
An example of the correct HTML comment:
<!-- main -->
<!-- header -->
<!-- navigation -->
<!-- content -->
Commented on CSS
/* article */
2 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
Text information is separated by a "space". No other additional symbols are required.
There is no need in closing comments. Just mark the beginning of the block styles.
The following form is incorrect:
/* ##### article ##### */
/* --== article ==-- */
Initial reset of elements (even if it is very small) should be commented as /* General
reset */.
Comments in CSS must correspond the comments in HTML.
If after "General reset" there follows the declaration of all main blocks, it is mentioned as
/* General settings */:
/* General settings */
#header{...}
#content{...}
#sidebar{...}
#footer{...}
An example of the correct CSS comment:
/* main */
/* header */
/* navigation */
/* content */
File Naming and Organization
The following example file structure should be used for static resources (framework-
specific conventions take precedence):
/css
/reset.css
/main.css
/ie.css
/images
/btn-submit.png
/btn-submit-SOURCE.psd
/js
3 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
Best Practices
 Use a global reset. A global reset helps create more consistent presentation
across browsers.
 Use sprites for all rollover/active states. CSS sprites prevent unwanted image
flicker on rollover. CSS sprites also reduce the total number of HTTP requests.
 Use as few browser-specific styles as possible. If needed, browser-specific
stylesheets or page classes (http://paulirish.com/2008/conditional-stylesheets-vs-
css-hacks-answer-neither/) should be used instead of putting CSS hacks in the
main stylesheet.
 Validate CSS.
Optimization Code and file
1. Use shorthand
If you’re not already writing in shorthand, you’re late to the party. But fortunately, this
party never ends. Using shorthand properties is the single easiest practice you can do to
cut down your code (and coding time). There’s no better time than the present to start
this efficient coding practice, or to review it.
Margin, border, padding, background, font, list-style, and even outline are all properties
that allow shorthand (and that’s not even an extensive list!).
CSS Shorthand means that instead of using different declarations for related
properties…
p { margin-top: 10px;
margin-right: 20px;
margin-bottom: 30px;
margin-left: 40px; }
… you may use shorthand properties to combine those values like so:
p { margin: 10px 20px 30px 40px; }
2. Axe the Hacks
we know that using conditional comments to serve hacks correctional declarations for IE6 and
IE7 is an accepted practice, even recommended by the Microsoft IE development team. Using
conditional comments to serve IE-specific CSS rules has the added benefit of serving a cleaner,
and therefore smaller, default CSS file to more standards-compliant browsers, while only those
browsers that need the hackery daiquri (i.e. IE) will download the additional page weight.
4 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
Here’s how to use conditional comments to serve styles only to Internet Explorer 6:
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6.css">
<![endif]-->
3.Optimize the file
Optimize the jpg and png
PNG is useful because it's the only widely supported format that can store partially
transparent images. The format uses compression, but the files can still be large. Use
PNGauntlet and to optimize the jpeg file use the jpegmini tools to shrink images for your
apps and sites. It will use less bandwidth and load faster.
PNG optimize tool
4.Optimize the js code and css code
Use the single file for the js and css file as follows the all.css for all the css code and
jquery.js for all the customize jquery code.
5 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
5. Use whitespace wisely
Whitespace, including spaces, tabs, and extra line breaks, is important for readability for
CSS code. However, whitespace does add, however miniscule it may be, to page
weight. Every space, line-break, and tab you can eliminate is like having one less
character. Always favor for single line formatting option without tabs. Eg. As follows
Multi-line formatting, double-spaced, indented code
Example
.code-standard{
background:transparent;
width:205px;
border:none;
overflow:hidden;
cursor:pointer;
}
Single-line formatting, single-spaced, no indentation
Example
.code-
standard{background:transparent;width:205px;border:none;overflow:hidden;cursor:poi
nter;}
6.Tidying up your HTML tags with indentation
You may already be finding that it is a bit hard to look at the HTML in your editor and to
understand it. Part of this will be the layout (part will be that HTML is confusing for a
while).
To help you to see the structure of a Web page's HTML it is best to indent the code. This
means putting tabs into your HTML. Remember that these tabs will not be shown on the
6 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
Web page (extra spaces and tabs are ignored by browsers the same way as line
breaks).
The idea is to put a tab before each line of code which is inside another tag. This makes
more sense if you see it. This is what you have in your file so far but properly indented:
Example
Wrong and untidy markup indention
7 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
Clean markup with Proper indention.
What Beautiful HTML Code Looks Like
http://css-tricks.com/examples/CleanCode/Beautiful-HTML.png
6.Use HTML and CSS Validator
Why Code validation for?
 Validation as a debugging tool
 Validation as a future-proof quality check
 Validation eases maintenance
 Validation helps teach good practices
 Validation is a sign of professionalism
For Markup validation use
http://validator.w3.org/
8 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
For CSS validation use
http://jigsaw.w3.org/css-validator/
Use the same class for all the markup and css
standard
Class names
 .panel, .bar (block with navigation and additional elements)
 .navbar (block with navigation. There can be additional elements)
 .navigation (block / list for navigation only)
 .main-nav (.main-navigation - main navigation)
 .add-nav (.add-navigation – additional navigation)
 .breadcrumbs (block / list with breadcrumbs)
 .tags (used for tags / tag list displaying)
 .topiclist (list of topics)
 .item-list (.product-list, .article-list, .recent-articles) – list of items (products), list of
articles (sections), list of the most frequent articles (sections)
 .paging ( block / list with pagination)
 .news (.news-list) – a list of news
 .tools (a list with icons (home, contact, sitemap, print, etc.))
 classes for the items of such list are:
.home, .contact, .sitemap, .print, etc.
Forms
 .login (.login-form)
 .search (.search-form)
 .subscribe (news subscription etc.)
 .newsletter (newsletters subscription)
 .details (a form with contact details)
 .profile (profile)
 .account (account (register entry))
 .information (a additional information form)
 .feedback (feedback communication)
 .poll, survey (poll)
 .vote (voting)
 .some-form (chose an appropriate word instead of “some”)
Step-by-step actions (used for forms, shopping forms etc)
 .steps (steps)
9 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
 .step - (step)
Blog
 .post – single post
 .entry-title – post title
 .entry-content - content of the post
 .meta - meta information about the post
 .updated - an update time
 .published - the time of publication
 .date (just em tag) - the date of publication
 .timestamp – label or tag of the post
 .discussion – comments block
 .comments - comments
 .list-comments - list of comments
 .add-comments – add a comment
RSS-icons
 .feed
 .rss
Active states
 .active
 .selected
Other units
 .box (block with borders)
 .block (can be borderless)
 .container (can be borderless)
 .section (for additional section)
 .item (to format a block with additional content, or any singular item, object
etc).
 .products (block with list of products)
 .items (block with a list of any additional elements)
 .article (block for an article or for the item / product description)
 .books (books, book description)
 .calendar (calendar)
 .visual ( block for images (for example: images attache to the article, post))
 .promobox (block for advertisements only)
 .photo (for photos)
 .featured-item (featured items)
 .alignleft, .alignright, .aligncenter (to align an image in the content part)
10 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
Header
 .logo
 .slogan
Footer
 .copyright
 .by
 .nav - if the list duplicates navigation links
 .listing (list) – for lists (do not use the class for the list if it is not necessary)
 .doc - if these are links to documentation («privacy», etc.)
Testimonials:
 .testimonials
More
 .all, .more ( link to display all content)
 .another (another)
 .details (link to additional information page)
General page layout
1. main block of the page - #wrapper.
2. main navigation of the page - #nav.
3. ID to be used for the following elements:
o #header (“billhead” of the document);
also possible:
o #main (page content );
o #twocolumns ( column: # content + sidebar);
o #content (content of the column);
o #sidebar (a unique column to the left or the right of the # content);
o #footer (foot of the page);
o elements for JavaScript;
o form elements that are associated with the corresponding label in
for / id.
Examples of marking for pages.
11 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
To mark up a unique side column use #sidebar.
To mark up an additional side column use .aside (. aside1,. aside2 if there are
two of them).
 Page with the main column and unique sidebar: ::
Doubleclick to copy
<div id="wrapper">
<div id="header"></div>
<div id="main">
<div id="content"></div>
<div id="sidebar"></div>
</div>
<div id="footer"></div>
</div>
 Page with the main column, unique sidebar and one additional column: ::
Doubleclick to copy
<div id="wrapper">
<div id="header"></div>
<div id="main">
<div id="twocolumns">
<div id="content"></div>
<div class="aside"></div>
</div>
<div id="sidebar"></div>
</div>
<div id="footer"></div>
</div>
 The page with the main column and two additional columns: ::
Doubleclick to copy
<div id="wrapper">
<div id="header"></div>
<div id="main">
<div id="twocolumns">
<div id="content"></div>
<div class="aside1"></div>
</div>
<div class="aside2"></div>
</div>
<div id="footer"></div>
12 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan,
designersaajan@gmail.com, Kathmandu ,Nepal.
</div>
Naming and accessibility
 logo.gif – main logo of the page
 logo.gif...logo10.gif – logos list
The logo image can be named after the owner's company
Examples: puma.gif, adidas.gif, microsoft.gif, contex.gif, durex.gif
 sponsor-logo1.gif (partner-logo1.gif – depending on the logo list title) – sponsors'
logos can also be named based on the companies' names: adidas.gif,
w3ukraine.gif etc, but please follow a certain logical order f.ex. there must be no
adidas.gif and logo10.gif in one list.
 btn-go.gif, btn-submit.gif, btn-name.gif – for form elements or for big block links.
 text-sometext.gif – for text replacement (titles).
 bg-body.gif, bg-footer.gif – for background images.
 img1.gif, img2.gif, item1.gif, item2.gif – for product lists, or non-systematized
images.
 ico-email.gif, ico-star.gif, flag-ua.gif, flag-uk.gif – for icons.
 separator.gif, divider.gif – if the image is being used as a separator
 bullet.gif(bullet-green.gif, bullet1.gif, bullet5.gif, bullet-small.gif, bullet-medium.gif)
– if the image is being used for list styling.
Variants of naming: arrow, arrow-red, arrow-small, arrow-left etc.
Image title must always be meaningful.
Do not write anything into “alt” attribute to preserve images accessibility.
We only write data into “alt” attribute when there is a demand of Web Accessibility,
SEO or Section508. “Alt” attribute content has to reflect the content or meaning of the
image. If it is impossible/difficult to write the content correctly, then put «image
description» in the “alt”
If Web Accessibility, SEO or Section508 are NOT required then you can set 'image
description' for all images.
If the image is meaningless (simply for design purposes) you don't need to set “alt”
attribute.

More Related Content

ODP
HTML5, CSS, JavaScript Style guide and coding conventions
PDF
AEM Sightly Template Language
PDF
Flexbox and Grid Layout
PDF
slingmodels
PPTX
Angular Data Binding
PDF
React JS and Redux
PDF
Workshop 21: React Router
PDF
HTML5: features with examples
HTML5, CSS, JavaScript Style guide and coding conventions
AEM Sightly Template Language
Flexbox and Grid Layout
slingmodels
Angular Data Binding
React JS and Redux
Workshop 21: React Router
HTML5: features with examples

What's hot (20)

PDF
Angular Directives
PPTX
An introduction to Vue.js
PDF
Nuxt.js et les applications isomorphiques (Universelles/SSR)
PDF
An introduction to Vue.js
PDF
Angular data binding
PPT
Introduction to Cascading Style Sheets
PPT
Learning Html
PDF
Less vs sass
PDF
Intro to HTML & CSS
PDF
BEM - CSS, Seriously
DOCX
Angular Interview Questions & Answers
PDF
Intro to HTML and CSS basics
PDF
JavaScript(Es5) Interview Questions & Answers
PDF
Javascript Basic
PPTX
An Introduction to the DOM
PDF
webpack 101 slides
PPTX
Java script basics
PPT
Learn javascript easy steps
Angular Directives
An introduction to Vue.js
Nuxt.js et les applications isomorphiques (Universelles/SSR)
An introduction to Vue.js
Angular data binding
Introduction to Cascading Style Sheets
Learning Html
Less vs sass
Intro to HTML & CSS
BEM - CSS, Seriously
Angular Interview Questions & Answers
Intro to HTML and CSS basics
JavaScript(Es5) Interview Questions & Answers
Javascript Basic
An Introduction to the DOM
webpack 101 slides
Java script basics
Learn javascript easy steps
Ad

Similar to HTML and CSS Coding Standards (20)

PDF
HowTo_CSS
PDF
HowTo_CSS
PDF
Structuring your CSS for maintainability: rules and guile lines to write CSS
PDF
Pfnp slides
PPTX
Web technologies part-2
PPT
Css training tutorial css3 &amp; css4 essentials
PPT
Introduction to BOOTSTRAP
PPT
Twitter bootstrap training_session_ppt
PPT
CSS Methodology
DOC
Intermediate Web Design.doc
DOC
Intermediate Web Design.doc
PDF
HTML Foundations, part 1
PDF
The CSS Handbook
PPT
Css week10 2019 2020 for g10 by eng.osama ghandour
PDF
CSS framework By Palash
PPT
Html & CSS - Best practices 2-hour-workshop
PDF
Html and html5 cheat sheets
PDF
Introduction to css
PPTX
Teched Inetrgation ppt and lering in simple
PDF
Download full ebook of Professional Css3 Sikora Piotr instant download pdf
HowTo_CSS
HowTo_CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
Pfnp slides
Web technologies part-2
Css training tutorial css3 &amp; css4 essentials
Introduction to BOOTSTRAP
Twitter bootstrap training_session_ppt
CSS Methodology
Intermediate Web Design.doc
Intermediate Web Design.doc
HTML Foundations, part 1
The CSS Handbook
Css week10 2019 2020 for g10 by eng.osama ghandour
CSS framework By Palash
Html & CSS - Best practices 2-hour-workshop
Html and html5 cheat sheets
Introduction to css
Teched Inetrgation ppt and lering in simple
Download full ebook of Professional Css3 Sikora Piotr instant download pdf
Ad

Recently uploaded (20)

PDF
Guide to Food Delivery App Development.pdf
PDF
AI-Powered Fuzz Testing: The Future of QA
PPTX
Trending Python Topics for Data Visualization in 2025
PPTX
Lecture 5 Software Requirement Engineering
PDF
Internet Download Manager IDM Crack powerful download accelerator New Version...
PDF
E-Commerce Website Development Companyin india
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
MCP Security Tutorial - Beginner to Advanced
PPTX
Airline CRS | Airline CRS Systems | CRS System
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
Download Adobe Photoshop Crack 2025 Free
PPTX
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
Visual explanation of Dijkstra's Algorithm using Python
PPTX
Introduction to Windows Operating System
Guide to Food Delivery App Development.pdf
AI-Powered Fuzz Testing: The Future of QA
Trending Python Topics for Data Visualization in 2025
Lecture 5 Software Requirement Engineering
Internet Download Manager IDM Crack powerful download accelerator New Version...
E-Commerce Website Development Companyin india
How to Use SharePoint as an ISO-Compliant Document Management System
BoxLang Dynamic AWS Lambda - Japan Edition
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Topaz Photo AI Crack New Download (Latest 2025)
MCP Security Tutorial - Beginner to Advanced
Airline CRS | Airline CRS Systems | CRS System
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
GSA Content Generator Crack (2025 Latest)
Download Adobe Photoshop Crack 2025 Free
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
Full-Stack Developer Courses That Actually Land You Jobs
Visual explanation of Dijkstra's Algorithm using Python
Introduction to Windows Operating System

HTML and CSS Coding Standards

  • 1. 1 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. Coding Standards 1.Comments on Code Commented on Markup <!-- header --> Text information is separated from the tag by a “space ”. No additional symbols are required. This form is incorrect: <!-- header ///// --> <!-- *** header *** --> You should comment: 1. main markup blocks (header, footer etc.) 2. main semantic blocks and elements (logo, navigation, breadcrumbs, article etc.} 3. main functional blocks and elements (sub-navigation, popup, search contact form etc.} If it is impossible to find a semantic title, you can use a block heading or class as a title: <!-- welcome block --> or <!-- block title --> An example of the correct HTML comment: <!-- main --> <!-- header --> <!-- navigation --> <!-- content --> Commented on CSS /* article */
  • 2. 2 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. Text information is separated by a "space". No other additional symbols are required. There is no need in closing comments. Just mark the beginning of the block styles. The following form is incorrect: /* ##### article ##### */ /* --== article ==-- */ Initial reset of elements (even if it is very small) should be commented as /* General reset */. Comments in CSS must correspond the comments in HTML. If after "General reset" there follows the declaration of all main blocks, it is mentioned as /* General settings */: /* General settings */ #header{...} #content{...} #sidebar{...} #footer{...} An example of the correct CSS comment: /* main */ /* header */ /* navigation */ /* content */ File Naming and Organization The following example file structure should be used for static resources (framework- specific conventions take precedence): /css /reset.css /main.css /ie.css /images /btn-submit.png /btn-submit-SOURCE.psd /js
  • 3. 3 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. Best Practices  Use a global reset. A global reset helps create more consistent presentation across browsers.  Use sprites for all rollover/active states. CSS sprites prevent unwanted image flicker on rollover. CSS sprites also reduce the total number of HTTP requests.  Use as few browser-specific styles as possible. If needed, browser-specific stylesheets or page classes (http://paulirish.com/2008/conditional-stylesheets-vs- css-hacks-answer-neither/) should be used instead of putting CSS hacks in the main stylesheet.  Validate CSS. Optimization Code and file 1. Use shorthand If you’re not already writing in shorthand, you’re late to the party. But fortunately, this party never ends. Using shorthand properties is the single easiest practice you can do to cut down your code (and coding time). There’s no better time than the present to start this efficient coding practice, or to review it. Margin, border, padding, background, font, list-style, and even outline are all properties that allow shorthand (and that’s not even an extensive list!). CSS Shorthand means that instead of using different declarations for related properties… p { margin-top: 10px; margin-right: 20px; margin-bottom: 30px; margin-left: 40px; } … you may use shorthand properties to combine those values like so: p { margin: 10px 20px 30px 40px; } 2. Axe the Hacks we know that using conditional comments to serve hacks correctional declarations for IE6 and IE7 is an accepted practice, even recommended by the Microsoft IE development team. Using conditional comments to serve IE-specific CSS rules has the added benefit of serving a cleaner, and therefore smaller, default CSS file to more standards-compliant browsers, while only those browsers that need the hackery daiquri (i.e. IE) will download the additional page weight.
  • 4. 4 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. Here’s how to use conditional comments to serve styles only to Internet Explorer 6: <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="ie6.css"> <![endif]--> 3.Optimize the file Optimize the jpg and png PNG is useful because it's the only widely supported format that can store partially transparent images. The format uses compression, but the files can still be large. Use PNGauntlet and to optimize the jpeg file use the jpegmini tools to shrink images for your apps and sites. It will use less bandwidth and load faster. PNG optimize tool 4.Optimize the js code and css code Use the single file for the js and css file as follows the all.css for all the css code and jquery.js for all the customize jquery code.
  • 5. 5 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. 5. Use whitespace wisely Whitespace, including spaces, tabs, and extra line breaks, is important for readability for CSS code. However, whitespace does add, however miniscule it may be, to page weight. Every space, line-break, and tab you can eliminate is like having one less character. Always favor for single line formatting option without tabs. Eg. As follows Multi-line formatting, double-spaced, indented code Example .code-standard{ background:transparent; width:205px; border:none; overflow:hidden; cursor:pointer; } Single-line formatting, single-spaced, no indentation Example .code- standard{background:transparent;width:205px;border:none;overflow:hidden;cursor:poi nter;} 6.Tidying up your HTML tags with indentation You may already be finding that it is a bit hard to look at the HTML in your editor and to understand it. Part of this will be the layout (part will be that HTML is confusing for a while). To help you to see the structure of a Web page's HTML it is best to indent the code. This means putting tabs into your HTML. Remember that these tabs will not be shown on the
  • 6. 6 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. Web page (extra spaces and tabs are ignored by browsers the same way as line breaks). The idea is to put a tab before each line of code which is inside another tag. This makes more sense if you see it. This is what you have in your file so far but properly indented: Example Wrong and untidy markup indention
  • 7. 7 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. Clean markup with Proper indention. What Beautiful HTML Code Looks Like http://css-tricks.com/examples/CleanCode/Beautiful-HTML.png 6.Use HTML and CSS Validator Why Code validation for?  Validation as a debugging tool  Validation as a future-proof quality check  Validation eases maintenance  Validation helps teach good practices  Validation is a sign of professionalism For Markup validation use http://validator.w3.org/
  • 8. 8 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. For CSS validation use http://jigsaw.w3.org/css-validator/ Use the same class for all the markup and css standard Class names  .panel, .bar (block with navigation and additional elements)  .navbar (block with navigation. There can be additional elements)  .navigation (block / list for navigation only)  .main-nav (.main-navigation - main navigation)  .add-nav (.add-navigation – additional navigation)  .breadcrumbs (block / list with breadcrumbs)  .tags (used for tags / tag list displaying)  .topiclist (list of topics)  .item-list (.product-list, .article-list, .recent-articles) – list of items (products), list of articles (sections), list of the most frequent articles (sections)  .paging ( block / list with pagination)  .news (.news-list) – a list of news  .tools (a list with icons (home, contact, sitemap, print, etc.))  classes for the items of such list are: .home, .contact, .sitemap, .print, etc. Forms  .login (.login-form)  .search (.search-form)  .subscribe (news subscription etc.)  .newsletter (newsletters subscription)  .details (a form with contact details)  .profile (profile)  .account (account (register entry))  .information (a additional information form)  .feedback (feedback communication)  .poll, survey (poll)  .vote (voting)  .some-form (chose an appropriate word instead of “some”) Step-by-step actions (used for forms, shopping forms etc)  .steps (steps)
  • 9. 9 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal.  .step - (step) Blog  .post – single post  .entry-title – post title  .entry-content - content of the post  .meta - meta information about the post  .updated - an update time  .published - the time of publication  .date (just em tag) - the date of publication  .timestamp – label or tag of the post  .discussion – comments block  .comments - comments  .list-comments - list of comments  .add-comments – add a comment RSS-icons  .feed  .rss Active states  .active  .selected Other units  .box (block with borders)  .block (can be borderless)  .container (can be borderless)  .section (for additional section)  .item (to format a block with additional content, or any singular item, object etc).  .products (block with list of products)  .items (block with a list of any additional elements)  .article (block for an article or for the item / product description)  .books (books, book description)  .calendar (calendar)  .visual ( block for images (for example: images attache to the article, post))  .promobox (block for advertisements only)  .photo (for photos)  .featured-item (featured items)  .alignleft, .alignright, .aligncenter (to align an image in the content part)
  • 10. 10 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. Header  .logo  .slogan Footer  .copyright  .by  .nav - if the list duplicates navigation links  .listing (list) – for lists (do not use the class for the list if it is not necessary)  .doc - if these are links to documentation («privacy», etc.) Testimonials:  .testimonials More  .all, .more ( link to display all content)  .another (another)  .details (link to additional information page) General page layout 1. main block of the page - #wrapper. 2. main navigation of the page - #nav. 3. ID to be used for the following elements: o #header (“billhead” of the document); also possible: o #main (page content ); o #twocolumns ( column: # content + sidebar); o #content (content of the column); o #sidebar (a unique column to the left or the right of the # content); o #footer (foot of the page); o elements for JavaScript; o form elements that are associated with the corresponding label in for / id. Examples of marking for pages.
  • 11. 11 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. To mark up a unique side column use #sidebar. To mark up an additional side column use .aside (. aside1,. aside2 if there are two of them).  Page with the main column and unique sidebar: :: Doubleclick to copy <div id="wrapper"> <div id="header"></div> <div id="main"> <div id="content"></div> <div id="sidebar"></div> </div> <div id="footer"></div> </div>  Page with the main column, unique sidebar and one additional column: :: Doubleclick to copy <div id="wrapper"> <div id="header"></div> <div id="main"> <div id="twocolumns"> <div id="content"></div> <div class="aside"></div> </div> <div id="sidebar"></div> </div> <div id="footer"></div> </div>  The page with the main column and two additional columns: :: Doubleclick to copy <div id="wrapper"> <div id="header"></div> <div id="main"> <div id="twocolumns"> <div id="content"></div> <div class="aside1"></div> </div> <div class="aside2"></div> </div> <div id="footer"></div>
  • 12. 12 Markup and CSS Code Standardization.| Prepared by: Saajan Maharjan, [email protected], Kathmandu ,Nepal. </div> Naming and accessibility  logo.gif – main logo of the page  logo.gif...logo10.gif – logos list The logo image can be named after the owner's company Examples: puma.gif, adidas.gif, microsoft.gif, contex.gif, durex.gif  sponsor-logo1.gif (partner-logo1.gif – depending on the logo list title) – sponsors' logos can also be named based on the companies' names: adidas.gif, w3ukraine.gif etc, but please follow a certain logical order f.ex. there must be no adidas.gif and logo10.gif in one list.  btn-go.gif, btn-submit.gif, btn-name.gif – for form elements or for big block links.  text-sometext.gif – for text replacement (titles).  bg-body.gif, bg-footer.gif – for background images.  img1.gif, img2.gif, item1.gif, item2.gif – for product lists, or non-systematized images.  ico-email.gif, ico-star.gif, flag-ua.gif, flag-uk.gif – for icons.  separator.gif, divider.gif – if the image is being used as a separator  bullet.gif(bullet-green.gif, bullet1.gif, bullet5.gif, bullet-small.gif, bullet-medium.gif) – if the image is being used for list styling. Variants of naming: arrow, arrow-red, arrow-small, arrow-left etc. Image title must always be meaningful. Do not write anything into “alt” attribute to preserve images accessibility. We only write data into “alt” attribute when there is a demand of Web Accessibility, SEO or Section508. “Alt” attribute content has to reflect the content or meaning of the image. If it is impossible/difficult to write the content correctly, then put «image description» in the “alt” If Web Accessibility, SEO or Section508 are NOT required then you can set 'image description' for all images. If the image is meaningless (simply for design purposes) you don't need to set “alt” attribute.