Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home AJAX-Tips
 

Shorter Version CSS Coding

 

CSS or Cascading Style Sheets are very important tool in an Ajax based application. They have to be properly coded so that they could be executed correctly. But that doesn’t mean developers have to be content with the longer version in coding CSS.


There is a way to shorten the coding of CSS so that the application would have lesser codes and implementation is faster. Browsers could also recognize this coding so browser incompatibility is no problem in case you wanted to use this version in CSS. Ultimately, this is a better option since it will make you code faster.


The Shorthand Formula

Success in shorthand CSS is based on knowing the formula. If you know when and where to place the variable or data; you’ll be able to execute CSS without additional lines.


The following are the formulae for shorthand CSS:


• CSS on Background: color, image, repeat or no-repeat, position
• CSS on List: style (color style), style type, position, url
• CSS on Font: size, height, weight (font thickness), font style, font family
• CSS on Borders, Margin and Padding (for space): top, right, bottom, left
• CSS on Border Style: width, color, style


The Disadvantage of Shorthand CSS

Although shorthand CSS could help you build an application faster, there is one disadvantage developers should remember when using CSS in an Ajax based application. CSS can only work in some areas of the application if they are used with DHTML.


Through DHTML, additional functions are implemented which creates real time data streaming and manipulation. DHTML could also improve the experience of the users since it provides interactive websites with very little effort. As the dynamic version of HTML, you can expect a good looking yet light application.


But DHTML in an Ajax based application is not only always browser friendly. There are tweaks developers have to implement in their Ajax based application so that it could read the data provided. The DOM is even a lot harder since they are not yet recognized even if it is considered as a very vital job.


All of these are considered when launching CSS on an Ajax based application. Although CSS could fully adapt to other programming languages and implement them with ease, the additional programming language has to deal with browser incompatibility.


JavaScript is well known for having some exceptions on coding which is very unique to JavaScript. As a result, not every browser in the world could deal with JavaScript. DHTML is no exception to browser problems. That means CSS could also experience the same problem. If they are being placed under DHTML, they would surely be misinterpreted in other browsers or not read at all if they are not coded according to the browser specification.


But overall, shorthand CSS is very helpful. Since it could be read by many browsers as a standalone, it will surely be adaptable. By using CSS in an Ajax based application, developers would have a better designed application. Practice the formulas so that you can easily implement them as if you’re just writing a code but in a faster pace.



Read Next: Preventing Variable Problems in Ajax



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links