Monday, 1 June 2009

Applying CSS Conditionally

It may happen that you have an exception on one or more of your pages where your styling deviates from standard. In addition to that, you may want to apply your style conditionally. You have several choices in order to solve that problem:

1. make changes to your css file
2. create a css file within your workspace and reference it in your page template
3. create an additional template for your new style

However, this reqiures severals steps and could be a problem in some cases:

- you are not managing your HTTP Server and your dba's need months in order to accept such a small change

- you need to make changes to your page templates

- you need to create an additional template (region template, report template, ...)

Sometimes you need to go that way but there are also situations where you could solve that as in this example in my Demo Application. Using Firefox and Web Developer Toolbar you can easily find out the classes and their properties referenced in your template. You can adjust those properties to whatever you need and put that code into the header text of your page:

<style>
.t10ReportsRegion .t10RegionBody {background-color:#E2E5EA;}
.t10ReportsRegion .t10ButtonHolder {background-color:#E2E5EA;}
</style>

and the style will be applied only on that particular page. This will overwrite the style applied through the class with the same name in your css file.

If you need to apply your style conditionally, you can do the following:

1. create a region with the highest sequence and do not apply any template to it,

2. put your code in the region source of that region

3. change the region to render conditionally


9 comments:

Term Papers said...

I have been visiting various blogs for my term papers writing research. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards

Mohammad Abul Kalam Azad said...

I've a applications containing almost 200 pages and in every pages have some field which is not updatable. now I'm trying to apply a one css class for all of my non updatable item but i'm stuck. Could you please help me?

Jessica George said...

this is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.

School Signs UK

Thamizharasi J said...

lot of things learnt from your blog. got more ideas for us. wonderful tips makes from yours. Executing and testing our status very helpful one.
IELTS coaching in chennai

Aruna Ram said...

These are a very effective concept. Nice blog and truly well post. It's very helpful for me. Such excellent content and thank you. Keep post and adding more unique concept.
Ethical Hacking Course in Chennai
Hacking Course in Chennai
TOEFL Coaching in Chennai
Japanese Classes in Chennai
IELTS Coaching in Chennai
Ethical Hacking Course in Adyar
Ethical Hacking Course in Porur
Ethical Hacking Course in Anna Nagar

sheela rajesh said...

Nice Article you have posted here. Thank you for giving this innovative information and
please add more in future.
PHP Training in Chennai
DOT NET Training in Chennai
Big Data Training in Chennai
Hadoop Training in Chennai
Android Training in Chennai
Selenium Training in Chennai
Digital Marketing Course in Chennai
JAVA Training in Chennai
German Classes in Chennai
Salesforce Training in Chennai
salesforce training institute in chennai
Salesforce Training in Annanagar

ajay prakash said...

Such an excellent and interesting blog, do post like this more with more information, this was very useful, Thank you.
Aviation Courses in Chennai
cabin crew training chennai
Airport Management Training in Chennai
airport ground staff training courses in chennai
medical coding course in chennai
fashion designing institute in chennai
best interior design courses in chennai

Ron Wale said...

Thanks for sharing such informative post. Keep on sharing such informative post. Buy E Cigarette Melbourne from leading online Store.

Aruna Ram said...

Thank you for your valuable information. It was very helpful for developing my knowledge and I want more kind of ideas from your blog. Keep blogging...
Hadoop Admin Training in Chennai
Hadoop Administration Training in Chennai
Tableau Training in Chennai
Informatica Training in Chennai
SAS Training in Chennai
Node JS Training in Chennai
Hadoop Admin Training in Anna Nagar
Hadoop Admin Training in Tnagar