lots of lots of inline CSS
Bug #1162211 reported by
Henrik G.
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
LenaSYS |
Fix Committed
|
Undecided
|
Unassigned | ||
0.1 |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
CSS should only be used inline if it is used in dynamics.
An example of such dynamics is if we for example change the width of an element using css, this could benefit from using a
limited amount of inline css only for that specific property. Any other css should be static and in a css file.
We also want the css to be merged into as few files as possible, so that changing one file results in _global_ style changes.
Are there any other views on this matter?
Changed in lenasys: | |
status: | New → Confirmed |
Changed in lenasys: | |
status: | Confirmed → In Progress |
Changed in lenasys: | |
status: | In Progress → Fix Committed |
Changed in lenasys: | |
status: | Fix Committed → Fix Released |
Changed in lenasys: | |
status: | Fix Released → Won't Fix |
status: | Won't Fix → Fix Committed |
To post a comment you must log in.
I agree with this.
It's worth noting that there are two kinds of "inline CSS":
1) CSS within the HTML style attribute, i.e. <p style="font-weight: bold;">Bold paragraph</p>
2) CSS within the HTML <style> tag, i.e. <style type="text/css">p { font-weight: bold; }</style> (always placed inside the <head> tag of the document)
Both of these kinds should be avoided where possible:
1) The only time the style="" attribute in HTML should be used is when PHP outputs a dynamic CSS value, for example:
<?php
echo '<p style="width: '. $dynamicWidthValue .'">Dynamic width paragraph</p>;
?>
Otherwise, external CSS files are preferred. If possible, we should use as many shared stylesheets as possible, to limit number of files and reduce redundancy.