|
CSS Coding Clean and Semantic Templates
The way to write clean HTML code by using semantic markups and minimize the use of <div> tag.
1.Remove Unnecessary <div> Tags
I’ve seen a lot of people wrap a <div> tag around the <form> or <ul> menu list. Why create an extra <div> tag that you don’t need? You can achieve the same result by applying the CSS rules to the selector.
2.Using Semantic Markups
Use semantic markups to code HTML documents (ie. <h1> for headings, <p> for paragraph text, and <ul> for list items).
3.Minimize the Usage of <div> Tags
4. Format Your Coding
5.Comment The Closing </div> Tags. For example: </div><!-- /End of div tag -->
Conclusion
* Minimize the use of <div> tags.
* Use the <div> tag for the main layout sections such as: header, content, sidebar, and footer.
* The content should be in semantic HTML tags, not <div> tags.
* Format the source code and label the closing </div> tags.
|