How to write your best code in Html and Css

Posted By : Darshan Dang | 31-Oct-2014

CSS HTML Best Code

HTML is a forgiving language and, therefore, pages will render without the use of the doctype or and elements. Without a doctype and these structural elements, pages will not render properly in every browser.

Unformatted way


 

Hello World

This is a web page.

formatted way


 
Hello World

Hello World

This is a web page.

How to create Syntax Organized

  • Use lowercase letters within element names, attributes, and values
  • Indent nested elements
  • Strictly use double quotes, not single or completely omitted quotes
  • Remove the forward slash at the end of self-closing elements

See Example : Unformatted way

	

India

Chicago, the third most populous city in the United States
  •  
  • 234 square miles
  •  
  • 2.715 lacs residents
  •  

Formatted way

India

Chicago, the third most populous city in the United States
  •  
  • 234 square miles
  •  
  • 2.715 lacs residents
  •  

Use the Alternative Text Attribute on Images

We should use always alt tag beacause alt attribute to provide context for images, example like-

	Our Company logo

Unformatted way

	.button,a {background:#ffffff; color:#ff0000;font-size:14px;}

Formatted way

		.button,
		a {
		background:#ffffff;
 		color:#ff0000;
		font-size:14px;
		}

Shorthand Properties

	.button {
 		margin:10px 5px 0 0;
		padding-left:10px;
	}

Thanks
Darshan dang

 

 

About Author

Author Image
Darshan Dang

Darshan is a creative UI designer with experience and capabilities to build compelling UI designs for Web and Mobile Applications. Darshan likes Punjabi songs and Travelling in Free Time .

Request for Proposal

Name is required

Comment is required

Sending message..