learn more...When CSS Gets Messed-up One of the great benefits of CSS is that it substantially reduces the repetitious formatting code out of the HTML mark up and consolidate the same in the CSS which saves the programmers a great deal of time and effort. The styles can be reused to build multiple text blocks and control layout and formatting on multiple pages. The best part is that it considerably saves a lot of development time having all the reusable formatting in a centralized location, especially when you edit or update your website. On the flip-side, CSS can get all messed-up as you keep on adding more styles to the style sheet. There are different styles to redefine HTML tag attributes, class and id selectors to format different text blocks, and also different styles for page layout. Again, while some of these styles are site wide, others are applicable to individual pages. Further, there are cross-browser compatibility issues and so forth. With all these stuffs going into the style sheet, often things become confusing unless you have developed a proper CSS strategy. Devising Your CSS Strategy Organize You CSS Styles – The most common blunder quite a few web developers commit is that they put all the styles for the entire site into one CSS file. Although this approach works for a small site with a very few pages having specific styles, for the bigger sites it is better use multiple CSS files. The key is to divide the style sheet file into different sections. For instance, in the main style sheet especially in the first section should contain the styles with the broadest site wide application, so it's mostly populated with styles that redefine the properties of HTML tags. The other section can contain styles to format common page elements, such as the navigation bar or footer. The styles that control site wide page layout can be placed in another section. Subsequent sections should create groupings of styles with a progressively more specific focus. Avoid "class-itus" – many web developers tend to overuse classes and IDs. Though it is one of the basics of CSS to add classes and IDs to the markup and define CSS styles to format page elements, some developer however, get in the mindset of creating a class for every little thing that needs formatting. Instead, it is much wiser to redefine the properties of HTML tags than creating a different class. Design for the best browser – Because of the its comprehensive use, most web coders tend to keep Internet Explorer browser in their mind while designing a web page. Later on, they make necessary adjustments in the style sheet to comply with other web browsers. Though, this looks pretty logical an approach. However, they by doing this they tend to write codes which contain all the idiosyncratic features of IE in the style sheet. As a result, it actually takes them a substantial time to make necessary adjustments in the codes for other browsers. Hence, they literally rework for a substantial portion of the code in the process. If as a web developer, you want to produce standard-compliant code, then previewing Mozilla's Firefox instead of Internet Explorer would be much more helpful to you. First of all, Mozilla’s Firefox is the most standard-compliant browsers available at the moment. Secondly, it has the web developer tool bar extension on it which will help you a great deal. After you code for Mozilla’s Firefox, you can test it for the other browsers and add hacks and code tweaks to fix compatibility issues. Author Box – Maneet Puri heads Day Robinson Services, a major IT solutions provider offering outsource website maintenance India services. For over last 10 years, Maneet has been assisting many offshore clients in implementing web-based applications for their websites. His company also delivers web development India and web design India services. Maneet offers exeperts advice on other web-based applications to his overseas clients. Maneet Puri spearheads Day Robinson Services India, a well-known name in the field of web based application services, web optimization services, and web development India services. Having over 10 years of industry experience, he has implemented web design India services for many of his international clients. He also offers expert advice on web-based application services, search engine optimization and various knowledge driven processes to his clients based overseas. |
||||||
Disclaimer
1) E-articles is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us to investigate the problem.
2) E-articles is not responsible for inaccuracies, falsehoods, or any other types of misinformation this article may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here. link to this article |