Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that if you are having problems with the size of your css files then it is time to <strong>rethink your styling strategy</strong>. The C in CSS stands for cascading. Quite often when CSS files get too big it is due to styles not being re-used where appropriate and through poor use of the cascading behaviour.</p> <p>I don't say this lightly. I have worked on some large, complex retail sites and currently on very complicated financial trading applications. Whenever I have come accross sites with more than a few hundred styles, we have achieved large improvements in design, reductions in complexity and improvement of maintainability by reducing css complexity.</p> <p>One place to start is doing a Google sesarch on <strong>css reset</strong>. There are multiple different implementations, but they generally follow the theme of overriding the differences in layout for each of the browsers and removing arbitrary borders, margins and padding etc. Starting with a clean slate, if you will. Then you can go ahead and build up your styles from there, being careful to make the most of <strong>cascading</strong> and <strong>css chaining</strong></p> <p>Chaining is where you have more than one class on an element. eg:</p> <pre><code>&lt;div class="box right small"&gt;&lt;/div&gt; </code></pre> <p><code>box</code> might have some general styles that you might like to apply to many block elements such as div, h1...h6, p, ul, li, table, blockquote, pre, form. <code>small</code> is self explanatory <code>right</code> might simply be aligned to the right, but with a right padding of 4px. Whatever. The point is that you can have multiple classes per element and build up the styling from reusable building blocks - groupings of individual style settings. Otherwise known as classes.</p> <p>On a very simple level, look for oportunities to combine styles:</p> <p>so:</p> <pre><code>h1 {font-family: tahoma, color:#333333; font-size:1.4em;} h2 {font-family: tahoma, color:#333333; font-size:1.2em;} h3 {font-family: tahoma, color:#333333; font-size:1.0em;} </code></pre> <p>becomes</p> <pre><code>h1, h2, h3 {font-family: tahoma, color: #333} h1 {font-size:1.4em;} h2 {font-size:1.2em;} h3 {font-size:1.0em;} </code></pre> <p>Only, slightly smaller, but do this kind of thing lots of times and you can make a difference.</p> <p>Also, <a href="http://jigsaw.w3.org/css-validator/" rel="noreferrer"><strong>Validate your css</strong></a>. This will help you spot errors in your code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload