<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Norman&#039;s Blog &#187; Optimierung</title>
	<atom:link href="http://www.normansblog.de/tag/optimierung/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.normansblog.de</link>
	<description>News über CSS, jQuery, Firefox und andere Browser sowie aktuelle Kinofilme.</description>
	<lastBuildDate>Fri, 21 Sep 2018 13:18:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Besseres CSS Schreiben</title>
		<link>http://www.normansblog.de/besseres-css-schreiben/</link>
		<comments>http://www.normansblog.de/besseres-css-schreiben/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 01:28:42 +0000</pubDate>
		<dc:creator>Norman</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Optimierung]]></category>

		<guid isPermaLink="false">http://www.normansblog.de/?p=1417</guid>
		<description><![CDATA[Wie schreibt man guten CSS-Code, den man auch in ein paar Jahren noch verstehen kann? Viele werden es kennen: Man bekommt eine Seite vorgesetzt und soll Layoutänderungen daran vornehmen &#8211; &#8220;Am besten nur über CSS!&#8221;, eigentlich wäre das kein Problem, nur sieht man in den seltensten Fällen durch das Wirrwarr, das der Vorgänger hinterlassen hat [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.normansblog.de/besseres-css-schreiben/"><img src="http://www.normansblog.de/wp-content/uploads/2009/11/css.png" alt="css" title="css" width="100" height="98" class="alignright size-full wp-image-1469" /></a>Wie schreibt man guten CSS-Code, den man auch in ein paar Jahren noch verstehen kann?</p>
<p>Viele werden es kennen: Man bekommt eine Seite vorgesetzt und soll Layoutänderungen daran vornehmen &#8211; &#8220;Am besten nur über CSS!&#8221;, eigentlich wäre das kein Problem, nur sieht man in den seltensten Fällen durch das Wirrwarr, das der Vorgänger hinterlassen hat hindurch. Da stehen ein Paar komische Klassen hier und seltsame Selektoren da.. keine Kommentare &#8211; alles scheint irgendwie durcheinander zu sein. Manchmal blickt man aber auch nach einer Weile selbst nicht mehr durch seinen eigenen Code.</p>
<p>Das muss nicht sein. Geht mit gutem Beispiel voran und lernt, wie man besseren, sauberen CSS-Code verfasst, der noch dazu in allen Browsern zu einem <a href="http://dowebsitesneedtolookexactlythesameineverybrowser.com/">nahezu identischen Ergebnis</a> führt.</p>
<p><span id="more-1417"></span></p>
<h3>1. CSS Reset einbinden</h3>
<p>CSS Reset bedeutet, dass alle Browser-Styles überschrieben werden, sodass die Darstellung bei allen Browsern bei Null anfangen kann. Auf dieser Basis lässt sich dann ein einheitliches Design beschreiben. Die Einbindung erfolgt entweder über eine gesonderte <code>reset.css</code> (vor eure eigentliche CSS platzieren) oder man schreibt die wenigen Zeilen in seine eigentliche CSS Datei (vor allen anderen Anweisungen).</p>
<p>Eine bekannte Reset-Methode ist die von <a href="http://meyerweb.com/">Eric Meyer</a>, einem international anerkannten CSS-Experten, der diverse Bücher veröffentlicht hat (darunter auch <a href="http://www.amazon.de/CSS-Definitive-Guide-Eric-Meyer/dp/0596527330/ref=sr_1_1?ie=UTF8&#038;qid=1258241979&#038;sr=8-1-fkmr0">CSS: The Definite Guide</a>). Folgender Code wird verwendet..</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">html<span style="color: #00AA00;">,</span> body<span style="color: #00AA00;">,</span> div<span style="color: #00AA00;">,</span> span<span style="color: #00AA00;">,</span> applet<span style="color: #00AA00;">,</span> object<span style="color: #00AA00;">,</span> iframe<span style="color: #00AA00;">,</span>
h1<span style="color: #00AA00;">,</span> h2<span style="color: #00AA00;">,</span> h3<span style="color: #00AA00;">,</span> h4<span style="color: #00AA00;">,</span> h5<span style="color: #00AA00;">,</span> h6<span style="color: #00AA00;">,</span> p<span style="color: #00AA00;">,</span> blockquote<span style="color: #00AA00;">,</span> pre<span style="color: #00AA00;">,</span>
a<span style="color: #00AA00;">,</span> abbr<span style="color: #00AA00;">,</span> acronym<span style="color: #00AA00;">,</span> address<span style="color: #00AA00;">,</span> big<span style="color: #00AA00;">,</span> cite<span style="color: #00AA00;">,</span> code<span style="color: #00AA00;">,</span>
del<span style="color: #00AA00;">,</span> dfn<span style="color: #00AA00;">,</span> em<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">,</span> img<span style="color: #00AA00;">,</span> ins<span style="color: #00AA00;">,</span> kbd<span style="color: #00AA00;">,</span> q<span style="color: #00AA00;">,</span> s<span style="color: #00AA00;">,</span> samp<span style="color: #00AA00;">,</span>
small<span style="color: #00AA00;">,</span> strike<span style="color: #00AA00;">,</span> strong<span style="color: #00AA00;">,</span> sub<span style="color: #00AA00;">,</span> sup<span style="color: #00AA00;">,</span> tt<span style="color: #00AA00;">,</span> var<span style="color: #00AA00;">,</span>
dl<span style="color: #00AA00;">,</span> dt<span style="color: #00AA00;">,</span> dd<span style="color: #00AA00;">,</span> ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> li<span style="color: #00AA00;">,</span>
fieldset<span style="color: #00AA00;">,</span> form<span style="color: #00AA00;">,</span> label<span style="color: #00AA00;">,</span> legend<span style="color: #00AA00;">,</span>
table<span style="color: #00AA00;">,</span> caption<span style="color: #00AA00;">,</span> tbody<span style="color: #00AA00;">,</span> tfoot<span style="color: #00AA00;">,</span> thead<span style="color: #00AA00;">,</span> tr<span style="color: #00AA00;">,</span> th<span style="color: #00AA00;">,</span> td <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">baseline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* remember to define focus styles! */</span>
<span style="color: #3333ff;">:focus </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
body <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
ol<span style="color: #00AA00;">,</span> ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* tables still need 'cellspacing=&quot;0&quot;' in the markup */</span>
table <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">separate</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
caption<span style="color: #00AA00;">,</span> th<span style="color: #00AA00;">,</span> td <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
blockquote<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span> blockquote<span style="color: #3333ff;">:after</span><span style="color: #00AA00;">,</span>
q<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span> q<span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
blockquote<span style="color: #00AA00;">,</span> q <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">quotes</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<blockquote class="warning"><p>Die Reset von Eric Meyer ist <strong>nicht</strong> das Maß aller Dinge. Sie ist dazu gedacht verändert und an das jeweilige Projekt angepasst zu werden. Hinterfragt sie also kritisch und passt sie euren Vorlieben und Erfahrungen an.</p>
</blockquote>
<p>Für die Minimalisten unter euch gibt es auch eine einfachere aber trotzdem recht effektive Methode. Dabei wird das Margin und Padding für alle Elemente (Universal Selector) auf Null gesetzt..</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h3>2. Keine Hacks, dafür Conditional Comments verwenden</h3>
<p>Im Laufe der Zeit haben sich &#8220;kluge&#8221; Leute Hacks für ältere Browser ausgedacht, um bestimmte W3C Standards auch auf diesen zum Laufen zu bringen. Baut man diese Hacks in sein CSS ein, kann es sein, dass damit euer Code <em>invalide</em> wird. Abgesehen davon, dass sie in der Community mittlerweile <a href="http://www.webdesignerwall.com/general/trash-all-ie-hacks/">verpönt</a> sind, sollte man wirklich <strong>auf Browser Hacks verzichten</strong>.</p>
<p>Stattdessen sollte man <a href="http://de.wikipedia.org/wiki/Conditional_Comments">Conditional Comments</a> benutzen um spezielle CSS-Dateien für die jeweiligen Problem-Browser einzubinden (meistens betrifft das nur IE6).</p>
<p>Conditional Comments werden über besondere Kommentare im <code>head</code>-Bereich (unterhalb eurer eigentlichen CSS) eingefügt. Um zum Beispiel eine CSS für alle IE-Versionen kleiner-gleich IE6 einzubinden, muss man folgenden Code ins HTML schreiben:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="hmtl4strict" style="font-family:monospace;">&lt;!--[if lte IE 6]&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;/pfad/zum/css/IE6.css&quot; type=&quot;text/css&quot;/&gt;
&lt;![endif]--&gt;</pre></td></tr></table></div>

<h3>3. Strukturieren &#038; Kommentare nutzen</h3>
<p>Euer Code sollte strukturiert und kommentiert sein. Um das zu erreichen versucht den Code in Bereiche zu gliedern, die auch im Front-End zu sehen sind: Basic HTML Tags, Navigation, Content, Header, Sidebar, Footer, Suche &#038; Formulare.. usw. Benutzt einfach eine Gliederung, die für euch funktioniert und halbwegs logisch aufgebaut ist. Um die Bereiche voneinander zu trennen, kann man einfach gut sichtbare Kommentar-Blöcke verwenden.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* ------------------------ */</span>
<span style="color: #808080; font-style: italic;">/* ------ Content --------- */</span>
<span style="color: #808080; font-style: italic;">/* ------------------------ */</span>
#<span style="color: #000000; font-weight: bold;">content</span> <span style="color: #00AA00;">&#123;</span>
	...
<span style="color: #00AA00;">&#125;</span>
#<span style="color: #000000; font-weight: bold;">content</span> p <span style="color: #00AA00;">&#123;</span>
	...
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Es empfiehlt sich außerdem einen einleitenden Kommentarblock zu schreiben, in den man Information rund um die CSS-Datei schreibt. Neben dem Autor (also dein Name) kann man Versionsnummer, letztes Bearbeitungsdatum und Kurzbeschreibung (auf Englisch) auch häufig genutzte Farbcodes oder ähnliches dazuschreiben. Diese Herangehensweise ist <a href="http://codex.wordpress.org/Theme_Development#Theme_Style_Sheet">unter WordPress Pflicht</a>, da das Backend wichtige Informationen über das Theme aus der CSS ausliest.</p>
<h3>4. Schlankes, effektives CSS schreiben</h3>
<p>Um schlankes und gleichzeitig effektives CSS zu schreiben, sollte man sich einige Punkte verinnerlichen.</p>
<ol>
<li><em>Aussagekräftige IDs und Klassennamen wählen</em>
<p>Bezeichner sollten auch ihren Namen gerecht werden: <code>#sidebar</code> ist besser als <code>#divleft</code>.</p>
</li>
<li><em>Selektoren gruppieren</em>
<p>Sollten unterschiedliche Tags, IDs oder Klassen die gleichen CSS Eigenschaften bekommen, gruppiert man die jeweiligen Selektoren.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">h4<span style="color: #00AA00;">,</span>
<span style="color: #cc00cc;">#header</span><span style="color: #00AA00;">,</span>
span<span style="color: #6666ff;">.block</span> <span style="color: #00AA00;">&#123;</span>
	...
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

</li>
<li><em>Kurze Selektoren</em>
<p>Wenn möglich sollten Selektoren so kurz wie möglich sein.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#sidebar</span> <span style="color: #6666ff;">.widget</span> h2.widgettitle</pre></td></tr></table></div>

<p>..ist viel zu lang, besser ist es so..</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#sidebar</span> h2</pre></td></tr></table></div>

<p>..obwohl sie beide das gleiche ansprechen.</p>
</li>
<li><em>Properties einrücken und alphabetisch sortieren</em>
<p>Um die Lesbarkeit des Codes zu erhöhen, ist es ratsam jede Property auf eine neue Zeile zu schreiben, sie einzurücken und alphabetisch zu sortieren. Das macht erstmal ein wenig Arbeit aber wenn man von Anfang an so vorgeht, ist man genauso schnell und es zahlt sich am Ende aus.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#sidebar</span> <span style="color: #00AA00;">&#123;</span> 
<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">20</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">22px</span><span style="color: #00AA00;">;</span> font-site<span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>..das ist wesentlich schlechter zu lesen als das hier..</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#sidebar</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
	font-site<span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">22px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">20</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

</li>
<li><em>Shortcodes verwenden</em>
<p>Um sich unnötige Arbeit zu ersparen sollte man immer die Kurzformen von Properties und Farbcodes verwenden.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#sidebar</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffaa99</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/bg_sidebar.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span><span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>..ist extrem umständlich, viel einfacher und kürzer gehts so..</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#sidebar</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fa9</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/bg_sidebar.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span> <span style="color: #933;">15px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

</li>
<li><em><code>!important</code> vermeiden</em>
<p>Die <code>!important</code>-Anweisung hat natürlich einen Sinn aber man sollte sie dennoch nur in Notfällen benutzen, da man sonst erhebliche Probleme mit dem Cascading bekommen kann.</p>
</li>
</ol>
<blockquote class="idea"><p>Habt ihr noch weitere Vorschläge? Wie formatiert Ihr euren Code? Teilt eure Meinung anderen einfach per Kommentar mit! <img src='http://www.normansblog.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.normansblog.de/besseres-css-schreiben/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
