Styles according the client's browser

   —   
Sooner or later every web developer realizes that variety of the browsers used by the clients make CSS styling quite complicated. The compatibility between browsers is a problem today and different ‘hack’ techniques need to be used to achieve your page is displayed the same in every browser.
The Kentico CMS provide you with simple, very effective and helpful information simplifying the issue. Every time the page code is rendered system add tiny information into the ‘body’ element’s ‘class’ definition. This information represents the type of the client's browser instance.

When viewing the page using the IE7 for example the ‘body’ element could look like ‘<body class="LTR IE7" >’. When using the FF for displaying the page the ‘body’ element could be rendered like ‘<body class="LTR Gecko" >’.

As you could see, styling is then just a little step. You don’t need to use any IMPORTANT directives, star notation or any other suppress styling techniques. You simply specify style for the element through the class as ‘.IE7’ or ‘.Gecko’ or any other rendered for the ‘body’ tag. Please review the page code rendered to find out what is the class info on your browser then.



See also:


Applies to: 3.x
Share this article on   LinkedIn

Jaroslav Kordula

Jaroslav joined Kentico in 2006. He is a Technical Leader in a development team whose main focus is content management. This includes Documents, Custom tables, Media libraries and other related functionality.

Comments