background preloader

Theming

Facebook Twitter

CSS Order Priority Tips and Tricks. In CSS, we often declare more than what we required, overwriting other styles definition.

CSS Order Priority Tips and Tricks

However, in CSS there are certain rules that we must obey for us to properly overwrite the rule that we want as well. In this article, you will find all the CSS order priority tips that can benefit you in writing effective and efficient CSS definition. Sequence Of Anchor Pseudo-classes The correct way of declaring a sequence anchor pseudo-classes is shown below, If you tried to mess the sequence up, you will find that the above ‘action’ will be overlapped. 4. Adding JavaScript to your theme or module. The PHP function drupal_add_js() lets you add a JavaScript file, setting or inline code to the page and it takes 5 parameters (see the api reference).

4. Adding JavaScript to your theme or module

The first parameter is always going to be a path to a js file, an array, or a piece of JavaScript code. If the second parameter is 'module' (the default), 'theme', or 'core', then the first parameter must be a path and the only difference between these three is the order in which the script tag will be placed relative to other scripts, i.e. core scripts first, then module scripts and finally theme scripts. If the second parameter is 'setting', then the first parameter must be an array of settings.