<?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>Konstruktors &#187; CSS</title>
	<atom:link href="http://konstruktors.com/blog/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://konstruktors.com</link>
	<description>Web Design, WordPress and Performance Services</description>
	<lastBuildDate>Sat, 19 May 2012 16:41:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta4-20805</generator>
<atom:link rel="hub" href="http://konstruktors.superfeedr.com/"/><atom:link rel="hub" href="http://pubsubhubbub.appspot.com/"/>		<item>
		<title>WebKit Bug: Anti-aliasing for @font-face&#160;fonts</title>
		<link>http://konstruktors.com/blog/web-design/3190-webkit-bug-anti-aliasing-for-font-face-fonts/</link>
		<comments>http://konstruktors.com/blog/web-design/3190-webkit-bug-anti-aliasing-for-font-face-fonts/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 14:43:15 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3190</guid>
		<description><![CDATA[This is a known Webkit bug &#8212; any text with @font-face applied will be rendered without anti-aliasing if there is a text element without anti-aliasing applied preceding it. Usually those are fonts smaller than 5px or monospaced fonts at small sizes which are rendered without anti-aliasing. I noticed this bug on this page &#8212; the [...]]]></description>
			<content:encoded><![CDATA[<p>This is <a href="http://seanmcb.com/junk/webkit-antialiasing-test.html">a known Webkit bug</a> &#8212; <strong>any text with <code>@font-face</code> applied will be rendered without anti-aliasing if there is a text element without anti-aliasing applied preceding it</strong>. Usually those are fonts smaller than 5px or monospaced fonts at small sizes which are rendered without anti-aliasing.</p>
<p><a href="http://jsfiddle.net/39GZd/7/"><img class="alignnone size-full wp-image-3191" title="Webkit @font-face anti-aliasing bug due to preceding font-size" src="http://konstruktors.com/wp-content/uploads/2011/10/webkit-font-aliasing-bug.png" alt="" width="500" height="211" /></a></p>
<p>I noticed this bug on <a href="http://putukrejums.lv/kazu-abc/">this page</a> &#8212; the heading &#8220;Kāzu ABC&#8221; was rendered aliased despite having the main menu in between that heading and the logo which had <code>font-size:1px;</code> applied. The only way to fix this is by avoiding aliased text directly before elements that use @font-face.</p>
<p>Here is <a href="http://jsfiddle.net/39GZd/7/">a live demo of the bug</a>.</p>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/design/158-were-back-with-a-free-font-suggestion-liberation-sans/' rel='bookmark' title='We&#8217;re back with a free font suggestion &#8212; Liberation&nbsp;Sans'>We&#8217;re back with a free font suggestion &#8212; Liberation&nbsp;Sans</a></li>
<li><a href='http://konstruktors.com/blog/web-design/1461-no-font-embedding-on-web/' rel='bookmark' title='No Font Embedding,&nbsp;Please'>No Font Embedding,&nbsp;Please</a></li>
<li><a href='http://konstruktors.com/blog/web-design/2899-replace-login-logo-with-site-name-link/' rel='bookmark' title='Replace WordPress Login Logo With Your Site&#8217;s Name and&nbsp;Link'>Replace WordPress Login Logo With Your Site&#8217;s Name and&nbsp;Link</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/3190-webkit-bug-anti-aliasing-for-font-face-fonts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS @Imports&#160;Suck</title>
		<link>http://konstruktors.com/blog/web-design/1159-css-imports-suck/</link>
		<comments>http://konstruktors.com/blog/web-design/1159-css-imports-suck/#comments</comments>
		<pubDate>Mon, 11 May 2009 23:21:27 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://konstruktors.com/blog/?p=1159</guid>
		<description><![CDATA[I have never used them, and here is why you shouldn&#8217;t use CSS @imports too. Via Monday By Noon.]]></description>
			<content:encoded><![CDATA[<p>I have never used them, and here is <a title="Why CSS @import is worse than simple meta links" href="http://www.stevesouders.com/blog/2009/04/09/dont-use-import/">why you shouldn&#8217;t use CSS @imports</a> too. Via <a href="http://mondaybynoon.com/">Monday By Noon</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/1159-css-imports-suck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove Border from Image&#160;Links</title>
		<link>http://konstruktors.com/blog/web-design/1122-remove-border-from-image-links/</link>
		<comments>http://konstruktors.com/blog/web-design/1122-remove-border-from-image-links/#comments</comments>
		<pubDate>Sat, 02 May 2009 01:09:38 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://konstruktors.com/blog/?p=1122</guid>
		<description><![CDATA[For illustrating anchor links in some cases you might want to use bottom-border instead of a default text-decoration:underline. In order to achieve that, one would use the following CSS rule: a { text-decoration:none; border-bottom:2px solid; } which also adds border to the bottom of all linked images. In order to remove it, you would think [...]]]></description>
			<content:encoded><![CDATA[<p>For illustrating anchor links in <a href="http://www.wolfslittlestore.be/2009/05/het-aimg-probleem-oplossen/">some cases</a> you might want to use <code>bottom-border</code> instead of a default <code>text-decoration:underline</code>. In order to achieve that, one would use the following CSS rule:</p>
<pre lang="css">a { text-decoration:none; border-bottom:2px solid; }</pre>
<p>which also adds border to the bottom of all linked images. In order to remove it, you would think that setting</p>
<pre lang="css">a img { border:none; }</pre>
<p>would be enough.<span id="more-1122"></span> However, the truth is that it removes only the border around the image and not the one from the anchor that surrounds it:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-1123 withborder" title="Anchor link image border before fix" src="http://konstruktors.com/wp-content/uploads/2009/05/anchor-link-border-image-before-fix.png" alt="Anchor link image border before fix" width="402" height="346" /></p>
<p>Luckily, if the image is higher than the line-height of the text, we can hide the bottom border of the image by setting:</p>
<pre lang="css">a img { border:none; vertical-align:top; }</pre>
<p>and you&#8217;re done.</p>
<p style="text-align: center;"><img class="size-full wp-image-1125 withborder aligncenter" title="Anchor link with hidden border around image" src="http://konstruktors.com/wp-content/uploads/2009/05/anchor-link-border-image-after-fix.png" alt="Anchor link with hidden border around image" width="158" height="88" /></p>
<h3>Why this works?</h3>
<p>By default both anchors and images are inline elements and by applying <code>vertical-align:top;</code> to an image inside an anchor, we move the anchor to the top of the image. For some reason images have higher <code>z-index</code> than anchors.</p>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/wordpress/2610-jquery-script-for-loading-more-posts/' rel='bookmark' title='jQuery Script for Loading More&nbsp;Posts'>jQuery Script for Loading More&nbsp;Posts</a></li>
<li><a href='http://konstruktors.com/blog/web-design/125-how-to-create-beautiful-and-elegant-html-lists-using-css/' rel='bookmark' title='How to Create Beautiful and Elegant HTML Lists Using&nbsp;CSS'>How to Create Beautiful and Elegant HTML Lists Using&nbsp;CSS</a></li>
<li><a href='http://konstruktors.com/blog/web-design/755-minimize-wordpress-2-7-dashboard-header/' rel='bookmark' title='Squeeze the Header of the New WordPress 2.7&nbsp;Dashboard'>Squeeze the Header of the New WordPress 2.7&nbsp;Dashboard</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/1122-remove-border-from-image-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Create Beautiful and Elegant HTML Lists Using&#160;CSS</title>
		<link>http://konstruktors.com/blog/web-design/125-how-to-create-beautiful-and-elegant-html-lists-using-css/</link>
		<comments>http://konstruktors.com/blog/web-design/125-how-to-create-beautiful-and-elegant-html-lists-using-css/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 22:40:01 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://konstruktors.com/blog/design-suggetions/125-how-to-create-beautiful-and-elegant-html-lists-using-css/</guid>
		<description><![CDATA[HTML list have become one of the most used HTML elements for marking-up various semantic content structures &#8212; navigation, comments and even image galleries. This article will explain and show you how to style lists inside blog posts, articles or other basic HTML documents. Before we start, it is necessary to understand the importance of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://konstruktors.com/wp-content/uploads/2008/02/anatomy-of-html-lists-unordered-ordered.png"><img class="aligncenter size-medium wp-image-129" title="Anatomy of HTML lists, unordered, ordered" src="http://konstruktors.com/wp-content/uploads/2008/02/anatomy-of-html-lists-unordered-ordered-500x290.png" alt="" width="500" height="290" /></a></p>
<p>HTML list have become one of the most used HTML elements for marking-up various semantic content structures &#8212; navigation, comments and even image galleries.</p>
<p>This article will explain and show you how to style lists inside blog posts, articles or other basic HTML documents.</p>
<p>Before we start, it is necessary to understand the importance of using specific HTML tags <code>&lt;ul&gt;</code> and <code>&lt;ol&gt;</code>, instead of simple numbering (like 1., 2. or •, ») for building lists. By applying content a semantic structure, we emphasize the relationships between different content elements. In case of lists we are able to imply that there is a <em>certain relationship</em> between all of the list members, which is possibly described by the paragraph introducing the list. It also helps screen reader users for whom the total number of items is announced before the rest of the list.<span id="more-125"></span></p>
<h3>Default list rendering in standards aware browsers and Internet Explorer</h3>
<p>Let&#8217;s look at the default rendering of ordered <code>&lt;ol&gt;</code> and unordered <code>&lt;ul&gt;</code> lists by Web standards aware browsers (with Gecko, Webkit or Opera rendering engine) and Internet Explorer (IE).</p>
<p><a href="http://konstruktors.com/wp-content/uploads/2008/02/list-rendering-standards-ie-thumb.png"><img class="aligncenter size-full wp-image-133" title="HTML list rendering. standards vs internet explorer" src="http://konstruktors.com/wp-content/uploads/2008/02/list-rendering-standards-ie-thumb.png" alt="" width="400" height="186" /></a></p>
<div class="image wide"></div>
<p>It turns out that IE applies default left side <strong>margin</strong> to the list container (<code>&lt;ul&gt;</code> and <code>&lt;ol&gt;</code>) while standards aware browsers apply left side <strong>padding</strong>. These differences in list rendering force us to set both padding and margin of <code>&lt;ul&gt;</code> to 0 and continue to work only with styling <code>&lt;li&gt;</code> tag.</p>
<p>Another thing we notice is that list bullets or numbering becomes invisible in IE with the left side margin set to 0.</p>
<h3>Getting the list rendering consistent among all browsers</h3>
<p>To solve the <em>invisible bullet</em> problem described above, its a good idea to use relative positioning of list containers <code>&lt;ul&gt;</code> and <code>&lt;ol&gt;</code>. By doing so, we will be able to create much more advanced list style later without repeating most of the CSS.</p>
<h4>CSS for simple lists</h4>
<pre lang="css">ul, ol {
   margin:auto -3em 1em 0;
   padding:0;
   position:relative;
   left:-3em;
   overflow:hidden;
}
li {
   margin-top:0.25em;
   margin-bottom:0.25em;
}
ul ul, ul ol,
ol ol, ol ul {
   margin-left:1em;
   padding-left:0;
}
ul li, ol li {
   margin-left:5em;
}
li li {
   margin-left:1em;
}</pre>
<h4>Internet Explorer specific CSS</h4>
<p>To fix IE&#8217;s ability to do the math correctly, we have to enable <a href="http://www.satzansatz.de/cssd/onhavinglayout.html">hasLayout</a> property for all of our <code>&lt;ul&gt;</code> and <code>&lt;ol&gt;</code> tags. This is done by using <a title="Read about conditional comments and how are they used for targeting different versions of IE" href="http://www.quirksmode.org/css/condcom.html">conditional comments</a>:</p>
<pre lang="html">ul, ol { height:0; overflow:visible; }
ul, ol { height:1%; }</pre>
<h5>Output</h5>
<p><img class="alignright" src="http://konstruktors.com/wp-content/uploads/2008/02/list-anatomy-simple-unordered.png" alt="Simple unordered list" width="200" height="170" /></p>
<p>List is now rendered equally in all browsers. For illustration purposes a yellow background is applied to the list container <code>&lt;ul&gt;</code>, gray border shows the dimensions of <code>&lt;ul&gt;</code>, while list items <code>&lt;li&gt;</code> have gray background.</p>
<h3><em>Flat</em> lists for more content per list item</h3>
<p>Sometimes you have multiple lines of content per list item and then it might be reasonable to align the lists with the rest of the content in order to sustain the vertical flow of it.</p>
<h4>CSS for <em>flat</em> lists</h4>
<pre lang="css">.flat li {
   margin-left:3em;
}
.flat li ul, .flat li ol {
   margin-left:1em;
   padding-left:0;
}
.flat li li {
   margin-left:0;
}</pre>
<p><img class="alignright" src="http://konstruktors.com/wp-content/uploads/2008/02/list-anatomy-flat-unordered.png" alt="Screenshot: flat HTML lists for more content" width="200" height="167" /></p>
<p>Notice the little amount of CSS, but more importantly that it is rendered equally among all of the browsers and we can still use the default bullet styles instead of images.</p>
<p>However, sometimes one might want to use custom style list bullets. This can be done using the <code>list-style-image</code> property in CSS.</p>
<h4>Lists with <em>custom style bullets</em></h4>
<p><img class="alignright" src="http://konstruktors.com/wp-content/uploads/2008/02/list-anatomy-unordered-custom-bullet-image.png" alt="Screenshot: HTML lists with custom bullet image" width="200" height="472" /></p>
<p><em>Note:</em> don&#8217;t forget to remove the line break after <code>list-style-image:</code> to get it working.</p>
<h4>CSS:</h4>
<pre lang="css">ul.bullet-a li {
   list-style-image:
    url('bullet-image-a.png');
}
ul.bullet-b li {
   list-style-image:
    url('bullet-image-b.png');
}</pre>
<p>Although the alignment of the list image is not pixel perfect among all of the browsers, it is more than satisfactory if the height of the bullet image doesn&#8217;t exceed 10 pixels. One might suggest to use background of <code>&lt;li&gt;</code> tag as a list bullet image, but this would brake the ability to combine multiple CSS identifiers per list, like <code>&lt;ul class="flat bullet-a"&gt;</code> because of inherited margin settings.</p>
<h3>All the small details</h3>
<p>Notice that the spacing between list items in the last example (rounded image bullets) is larger than the default one (arrow image bullets). This enhances readability and separates list items similarly to paragraphs. So here is the final set of CSS styles to suite most of the needs:</p>
<pre lang="css">.spaced {
    margin-bottom:0;
}
.spaced ul, .spaced ol {
    margin-top:1em;
}
.spaced li {
    margin-bottom:1em;
}</pre>
<pre lang="css">.indent li {
    padding-left:1em;
    text-indent:-1em;
}
.inside li {
    list-style-position:inside;
}
.clear li {
    list-style-type:none;
}</pre>
<p>You can see that one of the previous examples already utilizes the &#8220;spaced&#8221; styling, while &#8220;indent&#8221;, &#8220;inside&#8221; and &#8220;clear&#8221; might benefit from a few examples:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://konstruktors.com/wp-content/uploads/2008/02/indent-flat-clear-inside-html-lists.png" alt="Screenshot: Flat and indented list, clear list, inside list" width="450" height="137" /></p>
<h3>All of CSS combined &amp; list style cheat-sheet</h3>
<ul class="flat">
<li><a href="http://konstruktors.com/wp-content/uploads/2008/02/index.html">View all of the list style examples</a> in your browser.</li>
<li>View the resulting CSS as <a title="CSS for beautiful HTML lists" href="http://konstruktors.com/wp-content/uploads/2008/02/konstruktors-lists.css">a seperate file</a> (bullet images: <a title="Sample bullet image a" href="http://konstruktors.com/wp-content/uploads/2008/02/bullet-image-a.png"><img class="inline" src="http://konstruktors.com/wp-content/uploads/2008/02/bullet-image-a.png" alt="Sample bullet image a" /></a> <a title="Sample bullet image b" href="http://konstruktors.com/wp-content/uploads/2008/02/bullet-image-b.png"><img class="inline" src="http://konstruktors.com/wp-content/uploads/2008/02/bullet-image-b.png" alt="Sample bullet image b" /></a>)</li>
<li><a title="HTML list style CSS cheat sheet" href="http://konstruktors.com/wp-content/uploads/2008/02/konstruktors-html-list-cheat-sheet.pdf"> Download a list style CSS classname cheat-sheet</a> (.pdf) which you can print and use as a reference when composing your articles, blog posts or other HTML documents.</li>
</ul>
<h3>Screenshot showing the use of various HTML list styles</h3>
<p style="text-align: center;"><a href="http://konstruktors.com/wp-content/uploads/2008/02/list-example-result.png"><img class="withborder aligncenter" src="http://konstruktors.com/wp-content/uploads/2008/02/list-example-result-thumb.png" alt="List output example" width="450" height="306" /></a></p>
<h4>Internet Explorer specific HTML and CSS</h4>
<pre lang="html">ul, ol { height:0; overflow:visible; }
ul, ol { height:1%; }</pre>
<h3>Few suggestions:</h3>
<ul class="flat">
<li>Bullet image height preferably should not exceed 10 pixels. Lower image height makes them look better in Internet Explorer. If you want bullet images to be transparent, save them as transparent GIF or 8-bit PNG files.</li>
<li>You might find it useful to apply this styling only to your post content, which can be easily done by prepeding the identifier of your post wrapper (like <code>.post</code> or <code>.article</code>) to all of the list styles. The end result would be something like <code>.post ul, .post ol {}</code>.</li>
</ul>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/web-design/755-minimize-wordpress-2-7-dashboard-header/' rel='bookmark' title='Squeeze the Header of the New WordPress 2.7&nbsp;Dashboard'>Squeeze the Header of the New WordPress 2.7&nbsp;Dashboard</a></li>
<li><a href='http://konstruktors.com/blog/web-design/2899-replace-login-logo-with-site-name-link/' rel='bookmark' title='Replace WordPress Login Logo With Your Site&#8217;s Name and&nbsp;Link'>Replace WordPress Login Logo With Your Site&#8217;s Name and&nbsp;Link</a></li>
<li><a href='http://konstruktors.com/blog/web-design/2036-remove-index-html-from-the-url/' rel='bookmark' title='Remove index.html from the&nbsp;URL'>Remove index.html from the&nbsp;URL</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/125-how-to-create-beautiful-and-elegant-html-lists-using-css/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Take-away photo and image positioning CSS styles for blogs &#8212; idea for a&#160;plugin</title>
		<link>http://konstruktors.com/blog/wordpress/92-take-away-photo-and-image-positioning-css-styles-for-blogs-idea-for-a-plugin/</link>
		<comments>http://konstruktors.com/blog/wordpress/92-take-away-photo-and-image-positioning-css-styles-for-blogs-idea-for-a-plugin/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 04:26:22 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://konstruktors.com/blog/design-suggetions/92-take-away-photo-and-image-positioning-css-styles-for-blogs-idea-for-a-plugin/</guid>
		<description><![CDATA[After reading Kim&#8217;s comment regarding the Morning Racer theme, I had an idea of how to achieve a consistent image and photo placement in a WordPress blog even if you decide to change the theme. The solution would be a plugin which would provide a &#8220;standard&#8221; set of CSS classes for styling different image (and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://konstruktors.com/wp-content/uploads/2008/01/illustration-css-take-away-wordpress-plugin.png" alt="Illustration: CSS Take-Away WordPress plugin" width="121" height="140" /> After reading <a title="Kim Lindberg's blog" href="http://kim.syndromedia.se">Kim&#8217;s</a> <a title="Comment from Kim Lindberg regarding the Morning Racer theme" href="http://konstruktors.com/blog/sidenotes/73-say-hello-to-morning-racer/#comment-385">comment</a> regarding the <a title="Morning Racer theme download page" href="http://konstruktors.com/WordPressTheme/Morning-Racer">Morning Racer theme</a>, I had an idea of how to achieve a consistent image and photo placement in a WordPress blog even if you decide to change the theme.</p>
<p>The solution would be a plugin which would provide a &#8220;standard&#8221; set of CSS classes for styling different image (and other element) positioning.</p>
<p>The great thing is that you could use these CSS classnames with any theme you like as long as you have the plugin enabled. It would be also possible to specify a prefared classname <em>prefix</em> (for example, <code><strong>kd</strong>-wide</code>, <code><strong>mo</strong>-withborder-a</code> or <code><strong>pa</strong>-image-a</code>) so that the plugin&#8217;s CSS doesn&#8217;t mess with the theme&#8217;s CSS. It could also contain CSS styles for lists (like the &#8220;flat&#8221; and &#8220;spaced&#8221; ones used on this blog), &#8220;important&#8221; messages, etc.</p>
<p>A kind of a portable image positioning thing. And you wouldn&#8217;t have to learn new CSS classnames or image layout ideas offered by different theme authors.</p>
<p>What do you think? Maybe you have a suggestion of other items (apart from images and lists) that you would like to have special styling.</p>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/wordpress/3203-how-to-automatically-add-image-credit-or-source-url-to-photo-captions-in-wordpress/' rel='bookmark' title='How to Automatically Add Image Credit or Source URL to Photo Captions in&nbsp;WordPress'>How to Automatically Add Image Credit or Source URL to Photo Captions in&nbsp;WordPress</a></li>
<li><a href='http://konstruktors.com/blog/web-design/386-wordpress-theme-for-video-audio-podcast-websites/' rel='bookmark' title='Idea: WordPress Theme for Audio &amp; Video Podcast&nbsp;Websites'>Idea: WordPress Theme for Audio &amp; Video Podcast&nbsp;Websites</a></li>
<li><a href='http://konstruktors.com/blog/web-design/535-wordpress-dashboard-ui-idea-update/' rel='bookmark' title='WordPress Dashboard UI Idea&nbsp;Update'>WordPress Dashboard UI Idea&nbsp;Update</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/wordpress/92-take-away-photo-and-image-positioning-css-styles-for-blogs-idea-for-a-plugin/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Good and Bad CSS&#160;Identifiers</title>
		<link>http://konstruktors.com/blog/web-design/4-good-and-bad-css-identifiers/</link>
		<comments>http://konstruktors.com/blog/web-design/4-good-and-bad-css-identifiers/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 18:05:36 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://konstruktors.com/blog/various-topics/4-good-and-bad-css-identifiers/</guid>
		<description><![CDATA[To identify good and bad id and class names, it is important to understand the idea of the CSS.]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-77" title="Illustration: HTML poster. Semantic graphic design." src="http://konstruktors.com/wp-content/uploads/2008/01/html-poster-500x333.png" alt="" width="500" height="333" /></p>
<p>Seeing a <code>&lt;div class="left green"&gt;...&lt;/div&gt;</code> block in HTML code might hurt the eyes of a lot of web designers. To identify good and bad id and class names, it is important to understand the idea of the CSS.</p>
<p>The World Wide Web Consortium (W3C) <a href="http://www.w3.org/TR/REC-CSS2/">defines CSS2</a> as:</p>
<blockquote><p>a style sheet language that allows authors and users to attach style (e.g., fonts, spacing, and aural cues) to structured documents (e.g., HTML documents and XML applications). By separating the presentation style of documents from the content of documents, CSS2 simplifies Web authoring and site maintenance.</p></blockquote>
<p>Therefore class names <code>left</code>, <code>green</code> or <code>largetext</code> are theoretically good according to the first part of the CSS definition, but very very bad according to the second part, which can be illustrated with the following example.<span id="more-4"></span></p>
<p>Imagine that you need to change those customer testimony boxes to centred alignment and yellow background with different typeface. The result would be a class named <code>green</code> which defines yellow background and different typeface, and there is nothing <code>green</code> about that <code>&lt;div&gt;</code> block any more. What if you had also used the <code>green</code> class for styling the product descriptions? It soon would be impossible to maintain and expand a website that uses such CSS identifiers. Class name <code>testimonies</code> would be much more appropriate to the particular needs. In addition, the product description class <code>prod-desc</code> could be defined together with <code>testimonies</code> at first place and separated if such necessity arises.</p>
<p>In general, it is a sound practice to choose identifiers that describe the content of that HTML section, not how it looks.</p>
<h3>Design Limitations of the CSS</h3>
<p>Despite the beauty of semantic HTML mark-up and availability of CSS, the web currently has some intrinsic limitations for designers, who want complete control over the layout of the content.</p>
<p>Traditional graphic design has no need for semantic content. Graphic designers have two dimensional environment available, while the content of the web is linear. Graphic designers use the size, shape, colour and position of different content elements to create the structure of the message, but the web uses semantic HTML mark-up to structure its content. And CSS aims to be that ultimate presentation layer that adds the extra dimension also to the web content.</p>
<p>There is no way to tell Adobe Illustrator (or any other graphic authoring software) that the particular text is the main heading of a poster and that the image following it shows two people sitting in a beach, holding hands and watching sunset. In such context the graphical presentation of the content seems to be limiting over the semantic description available on the web. Semantics is the third dimension of the web content, which print medium will never have. The CSS, however, aims to define the second dimension of the web and make it closer to the print, in terms of freedom of layout.</p>
<p>Unfortunately the CSS currently doesn&#8217;t offer a complete control over the layout of the content. In general, however, web has far more ways of describing and defining its content than the print or video medium. The content of the web isn&#8217;t locked into the visual or audio definitions chosen by the designer. It symbolizes accessibility and availability of the<br />
information for everyone.</p>
<h3>Grid Layouts and Content Grouping</h3>
<p>In a grid based page layout the content is aligned with a certain number of equally spaced imaginative vertical lines. This creates a system of presentation which is visually harmonic and aids the reader in perceiving and understanding the content. (<a title="About Grid based page layouts on Wikipedia" href="http://en.wikipedia.org/wiki/Grid_(page_layout)">Wikipedia about the grid</a>)</p>
<p>Such simple and coherent presentation of textual and graphical content became popular after the Second World War together with the <a title="Modernism in art" href="http://en.wikipedia.org/wiki/Modernism">modernism</a> in traditional art.</p>
<p>The current version of CSS doesn&#8217;t directly provide ways to use columns and grids for presentation. And it is not the purpose of HTML either, as they don&#8217;t add any semantic description to the content.</p>
<p>Therefore web designers have to find ways of using existing CSS declarations and available HTML <code>&lt;div&gt;</code> tag, which is meant for sectioning and grouping the content.</p>
<p>One of the important characteristics of the grid is reusablility – it should be possible to devise a set of CSS classes that enable sectioning of the content into grids, and could be applied for any type of content. The only purpose of these classes is to define the grid, not the content inside the grid. This is important.</p>
<p>Such CSS definition requires two nested HTML <code>&lt;div&gt;</code> elements by design – one defines the grid while the other its content. Different interpretation of padding, margin and border rules among different browsers is another reason for having two separate <code>&lt;div&gt;</code> tags. For a consistent rendering of the grid, the extra mark-up is simply necessary.</p>
<p>Now a question to all the HTML purist out there (including me) – do grids define groups or sections of the content? If the answer is yes, then the use of extra mark-up is completely valid as defined by <a href="http://www.w3.org/TR/html401/struct/global.html#h-7.5.4">HTML specifications</a>.</p>
<h3>Content of the Grids</h3>
<p>The typical content of the grid requires a gutter or a padding so it doesn&#8217;t run into the column next to it. But notice, that this is the requirement of the content inside the grid, not the grid concept in general. Therefore, we need only two sets of CSS classes – one for the grid, and the other for its content. These classes could be repeated across the whole website.</p>
<p>Any number of standardized classes could be applied to grid content <code>&lt;div&gt;</code>, for example, to define the border or background of the particular grid column.</p>
<h3>Conclusions</h3>
<p>The choice of reusable and content specific CSS identifiers is very important in order to create websites that are scalable and easy to maintain.</p>
<p>For special design needs, such as grid based layouts, it is advisable to create a set of standard CSS definitions only for layout purposes that don&#8217;t describe the content inside the grids. Additional HTML mark-up is necessary to make such layouts consistent among all web browsers. Use of standardized CSS definitions and HTML mark-up for content groups reduces the total page size and significantly shortens the time for design alterations.</p>
<p>Creating complex layouts without extra HTML mark-up will become easy with the availability of <a href="http://www.w3.org/TR/css3-grid/">CSS3</a> which includes column separation of the content. Until then, sets of CSS and HTML definitions for commonly used layout elements will provide the only and the best possible solution (See <a title="CSS snippets for grid based and complex layouts" href="http://konstruktors.com">Konstruktors</a> CSS snippets, for example).</p>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/web-design/564-open-share-icon-that-looks-good-at-small-sizes/' rel='bookmark' title='Open Share Icon that Looks Good at Small&nbsp;Sizes'>Open Share Icon that Looks Good at Small&nbsp;Sizes</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/409-is-your-wordpress-theme-good-enough/' rel='bookmark' title='Is Your WordPress Theme Good&nbsp;Enough?'>Is Your WordPress Theme Good&nbsp;Enough?</a></li>
<li><a href='http://konstruktors.com/blog/web-design/898-mediatemple-disappointing-grid/' rel='bookmark' title='MediaTemple&#8217;s Disappointing&nbsp;Grid'>MediaTemple&#8217;s Disappointing&nbsp;Grid</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/4-good-and-bad-css-identifiers/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
