<?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>Web Designer Notebook &#187; Tools</title>
	<atom:link href="http://webdesignernotebook.com/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://webdesignernotebook.com</link>
	<description>Web Designer Notebook is a blog for web designers featuring topics like CSS, HTML and Wordpress, tutorials, reviews and inspiration.</description>
	<lastBuildDate>Sun, 22 Jan 2012 14:07:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Are CSS Frameworks Evil?</title>
		<link>http://webdesignernotebook.com/css/are-css-frameworks-evil/</link>
		<comments>http://webdesignernotebook.com/css/are-css-frameworks-evil/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 21:48:17 +0000</pubDate>
		<dc:creator>inayaili</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://webdesignernotebook.com/?p=1361</guid>
		<description><![CDATA[CSS frameworks have a tendency to be dismissed by many CSS authors; code bloat and non-semantic class names are usually at the top of the list of reasons why. Even without ever using one, I shared the same opinion, but that might have changed after trying a few of them out while doing some research [...]]]></description>
			<content:encoded><![CDATA[<p>CSS frameworks have a tendency to be dismissed by many CSS authors; code bloat and non-semantic class names are usually at the top of the list of reasons why. Even without ever using one, I shared the same opinion, but that might have changed after trying a few of them out while doing some research recently…</p>
<p><span id="more-1361"></span></p>
<h3>Existing frameworks</h3>
<p>There&#8217;s an abundance of CSS frameworks out there, from the simpler ones that only provide layout solutions to ones that include forms, typography and fluid layout modules.</p>
<p>From what I can tell, designers and agencies that work with frameworks on a regular basis tend to use either <a href="http://www.blueprintcss.org/" rel="nofollow" ><strong>Blueprint CSS</strong></a> or <a href="http://960.gs/" rel="nofollow" ><strong>960 Grid System</strong></a> (often abbreviated to 960gs). <a href="http://developer.yahoo.com/yui/3/cssgrids/" rel="nofollow" ><strong>Yahoo!&#8217;s YUI Grids</strong></a> is also a popular one. These were the three frameworks I experimented with.</p>
<h3>Preconceptions</h3>
<p>I had frameworks all figured out: they were for CSS authors who wanted to go with the easy solution and not create their own CSS foundations, or for those who didn&#8217;t really want to understand how CSS works — basically, anyone looking for an <strong>easy solution</strong>.</p>
<p>If there is one thing I dislike it is purists who aren&#8217;t open to other people&#8217;s ideas and that never change their minds. I love CSS and I can be a purist in some cases, but I also understand that <strong>not everything can be perfect</strong> and sometimes stylesheets are messy. We all aspire to create beautiful, clean code, that is semantic and valid, but when working on real projects, that keep being updated, where more than one person at different times edits the CSS, each one with their interpretation of &#8216;perfect&#8217; and with their own different level of expertise and experience, <strong>efficiency usually takes precedence</strong> over the purity of the code.</p>
<p>But I digress. What I mean to say is that sometimes we can use the odd non-semantic class name and no puppies will die. This is what frameworks are often criticised for. Class names like &#8216;<code>grid_16</code>&#8216; or &#8216;<code>span-8</code>&#8216; are far from being ideal, but given the need for being adaptable to any kind of project, they make sense (in most cases at least).</p>
<p>These non-semantic class names can be paired with better ID names (like &#8216;<code>class="span-8" id="aside"</code>&#8216;) or, when using HTML5, with semantic element names.</p>
<p>While I was trying these frameworks out, I asked a few questions on Twitter (mainly complaints, to be fair), and, even though this is not scientific, most people seemed to <strong>reprove the use of frameworks</strong>. I seem to remember someone even saying they are ‘useless’, and many more negative comments. Two or three people said they used them though, and were very happy about that (opinions diverged on which one).</p>
<h3>Wireframing</h3>
<p>I always had the idea that frameworks would be quite useful to create wireframes on the browser, so that was what I decided to replicate with Blueprint, 960gs and YUI 3 Grids, using a <em>very</em> simple layout.</p>
<h4>Blueprint</h4>
<p>The Blueprint CSS framework was created by <a href="http://bjorkoy.com/" rel="nofollow" >Olav Bjørkøy</a> and released in August 2007. It is usually considered to be the most comprehensive CSS framework, since it caters not only for grid-based layout creation but provides, and has, a <strong>solid typographic foundation</strong>, considering aspects like vertical rhythm. It also provides a reset and print stylesheet, and basic styling for forms.</p>
<p><a href="http://www.blueprintcss.org/" rel="nofollow" ><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2010/09/image-1-blueprint.jpg" alt="" title="Blueprint CSS homepage" width="500" height="472" class="alignnone size-full wp-image-1368" /></a></p>
<p>The framework uses by default a 24-column layout (each column spans 30 pixels and has a right margin of 10 pixels) but you can create different layouts by using the compressor included in the files.</p>
<p>Using Blueprint is as easy as including a wrapper with a class of “<code>container</code>” surrounding the remaining blocks on the page. Depending on the width of each of the internal containers, you need to use a class of, for example, “<code>span-24</code>”, for a div that spans across the entire width of the page, or “<code>span-8</code>”, for a block that spans across 8. If the container is the last one within a particular container or column, it should also include a class of “<code>last</code>”. The HTML for a the layout above would look like this (I have omitted the content, of course):</p>
<pre class="brush: xml; title: ; notranslate">&lt;body&gt;
	&lt;div class=&quot;container&quot;&gt;

		&lt;div class=&quot;span-24 b&quot;&gt;
		&lt;/div&gt;

		&lt;div class=&quot;span-6 b&quot;&gt;
		&lt;/div&gt;

		&lt;div class=&quot;span-18 last&quot;&gt;

			&lt;div class=&quot;span-15&quot;&gt;

				&lt;div class=&quot;span-15 last b&quot;&gt;
				&lt;/div&gt;

				&lt;div class=&quot;span-9 b&quot;&gt;
				&lt;/div&gt;

				&lt;div class=&quot;span-6 last b&quot;&gt;
				&lt;/div&gt;

			&lt;/div&gt;

			&lt;div class=&quot;span-3 last&quot;&gt;
			&lt;/div&gt;

			&lt;div class=&quot;span-18 last b&quot;&gt;
			&lt;/div&gt;

		&lt;/div&gt;

	&lt;/div&gt;
&lt;/body&gt;</pre>
<p>I’ve also added a class “<code>b</code>” (pardon the presentational name) to the <code>div</code>s that have content so that I could add a light background and some bottom margin to preview the wireframe better (we’re just doing a quick example here, so it’s OK to include this directly in the head):</p>
<pre class="brush: css; title: ; notranslate">.b { background:#d4d4d4; margin-bottom:10px; }</pre>
<p>Here’s a screenshot of the completed wireframe:</p>
<p><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2010/09/image-2-wireblueprint.jpg" alt="" title="Simple wireframe made with Blueprint CSS" width="500" height="346" class="alignnone size-full wp-image-1369" /></p>
<p>This took me <strong>less than 10 minutes</strong> to make (I know it’s pretty basic though), including having a quick read through the Getting Started guides.</p>
<h4>960gs</h4>
<p>The 960 Grid System CSS framework was developed by <a href="http://sonspring.com/" rel="nofollow" >Nathan Smith</a> and was released in March 2008. This framework was developed with a strong <strong>focus on the grid</strong>; even though it provides basic typographic styles, its main purpose is to  deliver a cross-browser foundation (it has full A-Grade browser support, <a href="http://developer.yahoo.com/yui/articles/gbs/" rel="nofollow" >as defined by Yahoo!</a>) that allows for many variations of the most common grid-based layouts.</p>
<p><a href="http://960.gs" rel="nofollow" ><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2010/09/image-3-906gs.jpg" alt="" title="906 Grid System homepage" width="500" height="472" class="alignnone size-full wp-image-1370" /></a></p>
<p>For 960gs I’m going with an even simpler layout — the main idea here is to show the differences between class naming and nesting from framework to framework.</p>
<p>The framework works, by default, on either a 12 or 16 column grid. We need to add a container surrounding the inner blocks with a class of “<code>container_16</code>” (or “<code>container_12</code>”); the inner containers should have classes of “<code>grid_16</code>”, “<code>grid_14</code>”, etc., depending on how many columns they span. Here is the final HTML markup for our simple layout:</p>
<pre class="brush: xml; title: ; notranslate">&lt;body&gt;
	&lt;div class=&quot;container_16&quot;&gt;
		&lt;div class=&quot;grid_16 b&quot;&gt;
			Header
		&lt;/div&gt;
		&lt;div class=&quot;grid_4 b&quot;&gt;
			Sidebar
		&lt;/div&gt;
		&lt;div class=&quot;grid_12 b&quot;&gt;
			Main content
		&lt;/div&gt;
		&lt;div class=&quot;grid_16 b&quot;&gt;
			Footer
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;</pre>
<p>And this what you should see:</p>
<p><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2010/09/image-4-wire960gs.jpg" alt="" title="Wireframe created with the 960 Grid System framework" width="500" height="346" class="alignnone size-full wp-image-1371" /></p>
<p>As with Blueprint, there are several tools online that allow you to configure the framework to your needs. <a href="http://www.designinfluences.com/fluid960gs/" rel="nofollow" ><strong>Fluid 960 Grid System</strong></a> is based on the original 960 Grid System, but allows for fluid and fixed layouts, and includes basic styling for elements such as navigation, tables, forms, articles and typography.</p>
<h4>YUI 3 Grids</h4>
<p>The YUI 3 Grids framework is part of the Yahoo! User Interface Library (YUI). The library includes JavaScript resources as well as CSS (YUI 3 CSS also incorporates reset and typography stylesheets). It works in a similar way to the other frameworks presented in this chapter, with a difference: there is <strong>no predefined width</strong> for the main container, only predefined “units” in which a container can expand within another container.</p>
<p><a href="http://developer.yahoo.com/yui/3/cssgrids/" rel="nofollow" ><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2010/09/image-5-yui.jpg" alt="" title="YUI 3 Grids web page" width="500" height="472" class="alignnone size-full wp-image-1372" /></a></p>
<p>In this case, we need to add the desired width to the <code>body</code> element of our page, as such:</p>
<pre class="brush: css; title: ; notranslate">body {
  	 margin: auto;
  	 width: 960px;
}</pre>
<p>The “<code>margin: auto</code>” property will centre our content on the page. Next, as with the other frameworks, we need to include a wrapper container with the class “<code>yui3-g</code>”. The containers within it will take class names based on the percentage of the width they should fill (or “units”). So, for example, if the sidebar takes up one third of the total width, it should have a class of “<code>yui3-u-1-3</code>”, and if the main content area takes up two thirds of the total width, it should have a class of “<code>yui3-u-2-3</code>”. YUI comes with a set of predefined unit classes (which are listed in the framework’s website).</p>
<p>The final example would have the following HTML:</p>
<pre class="brush: xml; title: ; notranslate">&lt;body&gt;
	&lt;div class=&quot;yui3-g&quot;&gt;
		&lt;div class=&quot;yui3-u-1 b&quot;&gt;
			Header
		&lt;/div&gt;
		&lt;div class=&quot;yui3-u-1-3 b&quot;&gt;
			Sidebar
		&lt;/div&gt;
		&lt;div class=&quot;yui3-u-2-3 b&quot;&gt;
			Main content
		&lt;/div&gt;
		&lt;div class=&quot;yui3-u-1 b&quot;&gt;
			Footer
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;</pre>
<p>Looking like this:</p>
<p><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2010/09/image-6-wireyui.jpg" alt="" title="Simple wireframe created with YUI 3 Grids" width="500" height="346" class="alignnone size-full wp-image-1373" /></p>
<p>Notice that YUI doesn’t have gutters between the columns — I see that as a downside.</p>
<h3>My favourite</h3>
<p>For me there&#8217;s a clear winner and it&#8217;s <strong>Blueprint</strong>. The guide was clear, it provides lots of tutorials and examples from within the front page of the website, and the fact that it provides a good typographic foundation is a major advantage.</p>
<p>Another advantage of Blueprint is the community behind it, which is constantly creating and releasing new plugins, themes and other tools that can be used in conjunction with the basic framework.</p>
<p>I felt <strong>960gs</strong>&#8216;s logic a lot harder to understand; it took me more than 30 minutes to figure out how the framework worked and finish the layout. If I&#8217;m going to use a framework I will be doing it to save time, so I didn&#8217;t find that experience very nice. Also, contrary to Blueprint&#8217;s website, 960gs&#8217;s didn&#8217;t have a clear &#8216;getting started&#8217; tutorial, so I had to look for articles outside of the site to &#8216;get started&#8217;. I do like the Fluid 960gs framework, but I&#8217;m not sure if there isn&#8217;t something similar for Blueprint.</p>
<p>Most people that I’ve talked to while doing this little experiment mentioned that they didn’t really appreciate frameworks, but the ones who did, swore by 960gs, so it might have been that I just wasn’t introduced to it the right (or simpler) way. There are beautiful websites built on top of this framework (a quick look at its website is enough proof), like the gorgeous Black Estate Vineyard:</p>
<p><a href="http://blackestate.co.nz/" rel="nofollow" ><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2010/09/image-7-blackestate.jpg" alt="" title="Black Estate Vineyard website" width="500" height="613" class="alignnone size-full wp-image-1374" /></a></p>
<p>The fact that <strong>YUI</strong> is adaptable to any width is a major plus, but the reduced amount of unit combinations made it a little uncomfortable to use, and I felt somewhat restricted as to what I could do with my layouts. If this is incorrect, I&#8217;d love it if someone would let me know, I couldn&#8217;t find a way around it easily in the getting started guide.</p>
<h3>Conclusion</h3>
<p>I&#8217;ve mentioned above that I believed CSS frameworks to be &#8216;the easy solution&#8217;. I still think that&#8217;s true, but I don&#8217;t see it as a bad thing: why spend hours creating perfectly hand-crafted CSS layouts when there are excellent foundations that we can build upon already out there? Life&#8217;s not just about coding (really) and there are better things that I can be doing with my time than creating problems for which there are solutions already.</p>
<p>This doesn&#8217;t mean, however, that I believe everyone should be using existing frameworks in their projects. Ideally, you&#8217;d be working with <strong>your own framework</strong> or template, adapted to your needs. It just means that I don&#8217;t think CSS frameworks should be treated like a bad thing and they can definitely be useful in some cases, or even as a base or inspiration for creating a custom framework. And I will certainly not condemn any designer or agency that uses out-of-the-box solutions, like Blueprint, because the benefits that you get from using those can surpass the downsides like verbose stylesheets and non semantic class names.</p>
<p>Don’t get me wrong: I thrive on a good piece of semantic HTML and CSS, and like most of you I also wanted to throw up the first time I looked at the non-semantic classes that these frameworks use. I will look at you sideways if your navigation is a paragraph rather than a list and I may unfollow you on Twitter if I know you’ve ever used class names like “<code>redLink</code>”. I still believe that the non-semantic class names are the <strong>least desirable feature</strong> of frameworks; ideally we shouldn&#8217;t have classes like that in our stylesheets, but I also think there are times when we need to be flexible and adapt ourselves and accept that things like this will happen.</p>
<p>Maybe they are a good solution for quick or <strong>low budget projects</strong>, or prototypes (although prototype code will often move on to production, so beware if you’re especially lazy, like me). I just thought this would be a good topic to discuss, and I guess I don’t mind saying that <a href="http://webdesignernotebook.com/tools/in-dreamweavers-defense/" rel="nofollow" >I like stuff people usually get repulsed by</a>, so here.</p>
<p>My verdict: no, frameworks are <em>not</em> evil.</p>
<p>So my question is, have you ever used a framework? Do you agree that they are a great tool, or have I gone crazy? I&#8217;d love to hear your thoughts.</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignernotebook.com/css/are-css-frameworks-evil/feed/</wfw:commentRss>
		<slash:comments>74</slash:comments>
		</item>
		<item>
		<title>My thoughts on LESS</title>
		<link>http://webdesignernotebook.com/css/my-thoughts-on-less/</link>
		<comments>http://webdesignernotebook.com/css/my-thoughts-on-less/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 00:10:36 +0000</pubDate>
		<dc:creator>Inayaili León</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://webdesignernotebook.com/?p=1327</guid>
		<description><![CDATA[I’ve started using LESS a few months ago on a few projects. LESS allows you to extend the way you write CSS, letting you use variables, nested selectors, operations and mixins. It sounds great — and it is great — but there are a few things that can make it work against you. These are [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve started using <a href="http://lesscss.org/" rel="nofollow" >LESS</a> a few months ago on a few projects. LESS allows you to extend the way you write CSS, letting you use variables, nested selectors, operations and mixins. It sounds great — and it <em>is</em> great — but there are a few things that can make it work against you. These are some of my thoughts on LESS.</p>
<p><span id="more-1327"></span></p>
<h3>What is LESS?</h3>
<p>LESS — Leaner CSS — is, in the <a href="http://www.usabilitypost.com/2009/06/16/introducing-less-a-better-css/" rel="nofollow" >authors&#8217; own words</a>, a “<strong>new version of CSS</strong>” (better yet, of writing CSS), that is then compiled into “traditional” CSS using the LESS compiler.</p>
<p>There are 4 main things you can do with LESS that you can’t with normal CSS:</p>
<h4>1. Variables</h4>
<p>You can define a variable, such as “<code>@text-color</code>”, and use it throughout your stylesheet. If the colour of your text changes, you only need to change it once in your CSS — where the variable is initially defined.</p>
<h4>2. Nested selectors</h4>
<p>With nested selectors, instead of doing this and repeating yourself:</p>
<pre class="brush: css; title: ; notranslate">aside h1 { font-size: 24px; }
aside h2 { font-size: 18px; }</pre>
<p>You can have:</p>
<pre class="brush: css; title: ; notranslate">aside {
	h1 { font-size: 24px; }
	h2 { font-size: 18px; }
}</pre>
<h4>3. Operations</h4>
<p>You can add, subtract, divide and multiply using operations. Here’s a quick example:</p>
<pre class="brush: css; title: ; notranslate">@wrappers: 600px;

aside {
    width: @wrappers / 2;
}</pre>
<p>This is definitely not the best example, but it should be enough for you to get the point.</p>
<h4>4. Mixins</h4>
<p>Mixins work a lot like variables, but you can specify a whole class in one. For example:</p>
<pre class="brush: css; title: ; notranslate">.b-radius {
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
}

.box {
	.b-radius;
}</pre>
<p>From these examples, I suppose you can say that <em>LESS is actually more</em>. (I’m sorry, I couldn’t help myself.)</p>
<h3>This is not a &#8220;how to&#8221; guide</h3>
<p>The <a href="http://lesscss.org/docs" rel="nofollow" >official LESS documentation</a> is very clear on how to install it. I have to admit I usually stop reading instructions whenever &#8220;Terminal&#8221; is mentioned (and I know more people do), but I guess most CSS authors will be OK with it — if not, ask for help to your nearest web dev (or email me and I’ll give you the phone number of one).</p>
<p>After it’s installed, you’ll have <strong>two files</strong>: the .less file — this is the file you&#8217;ll be working with — and the compiled .css file.</p>
<p>There&#8217;s also <a href="http://incident57.com/less/" rel="nofollow" >LESS app</a>, that makes it easier to use LESS. And I suppose that some CMS and servers let you use LESS directly, but the point of this article is not to teach anyone how to install it — it&#8217;s to go through its good and bad points.</p>
<p>On to the important bit…</p>
<h3>How LESS can make your life easier</h3>
<p>This is a list of things that, in my opinion, <strong>make LESS worthwhile</strong> and can really simplify your CSS. These are the things that I usually miss the most when I’m not working on LESS files.</p>
<h4>1. Variables</h4>
<p>Surely when you are writing your CSS there are colours, measurements, etc. that you <strong>keep using over and over</strong>. For example, let&#8217;s say your brand colour is jade (very fashionable for Spring/Summer 2010). You may use it on various elements in your design, for example, the main text:</p>
<pre class="brush: css; title: ; notranslate">body {
    …
    color: #77b59d;
    …
}</pre>
<p>Or the borders of your posts:</p>
<pre class="brush: css; title: ; notranslate">article {
    …
    border-bottom: 1px solid #77b59d;
    …
}</pre>
<p>Or as the background of your footer:</p>
<pre class="brush: css; title: ; notranslate">footer {
    …
    background-color: #77b59d;
    …
}</pre>
<p>If someone has to edit the CSS file and doesn&#8217;t know exactly which colour he or she is supposed to be using — it may even be you a few months later —, what happens is that either you&#8217;ll spend some time scanning through the document until you find the colour, you&#8217;ll use Firebug or, if you like to complicate things, use xScope or take a screenshot and use Photoshop to detect the colour.</p>
<p>This is silly. You&#8217;ll end up with many similar colours instead of just one. (As a note, Dreamweaver lists all the colours that a site is using — you&#8217;d be surprised at how inconsistent some CSS authors can be when applying colour.)</p>
<p>Another thing that may happen is when you actually want to change this colour throughout your stylesheet: <strong>you&#8217;ll have to edit every instance of it</strong> — that&#8217;s painful.</p>
<p>With a variable, you can have this:</p>
<pre class="brush: css; title: ; notranslate">@main-color: #77b59d;

body {
    …
    color: @main-color;
    …
}

article {
    …
    border-bottom: 1px solid @main-color;
    …
}

footer {
    …
    background-color: @main-color;
    …
}</pre>
<p>Beware though: you can easily <strong>go overboard with variables</strong>. I have to confess I was inebriated in the beginning by the thought of never having to declare a colour, a padding value, etc. again, and started adding too many variables to my LESS files. It gets messy and complicated quickly. You&#8217;ll have to <strong>find a balance</strong>.</p>
<h4>2. Accessors</h4>
<p>If you only need to <strong>access something once</strong>, you probably don’t need a variable. If you&#8217;re pretty sure that that thing you need to access is, and will always be, directly linked to whichever thing you&#8217;re linking it to, you can use an accessor.</p>
<p>Let&#8217;s say you have a block with a heading and some text. You want the border of that box to always be the same colour as the heading. You can have this:</p>
<pre class="brush: css; title: ; notranslate">#sales {
    border-color: #ae7b2a;
}

#sales h2 {
    color: #sales['border-color'];
}</pre>
<p>Using accessors may be going a step too far in some cases, but in other cases it makes a lot of sense — I think they&#8217;re quite useful.</p>
<h4>3. Mixins</h4>
<p>One example: gradients. Let’s face it, they are <strong>an absolute pain to write</strong>. Take a look at how LESS makes it easier for you:</p>
<p>The mixin:</p>
<pre class="brush: css; title: ; notranslate">.grad-linear (@start:&quot;&quot;, @end:&quot;&quot;) {
    background: -webkit-gradient(linear, left top, left bottom, from(@start), to(@end));
    background: -moz-linear-gradient(-90deg,@start,@end);
}</pre>
<p>Using the mixin in your .less file:</p>
<pre class="brush: css; title: ; notranslate">nav {
	.grad-linear(#b3cdcc,#718a89);
}</pre>
<p>What your compiled .css file will show:</p>
<pre class="brush: css; title: ; notranslate">nav {
	background: -webkit-gradient(linear, left top, left bottom, from(#b3cdcc), to(#718a89));
	background: -moz-linear-gradient(-90deg, #b3cdcc, #718a89);
}</pre>
<p>Mixins are great for properties that still require that we add some vendor-specific code (like <code>border-radius</code>) or for the latest CSS3 gradients, transitions, etc.</p>
<p>I have to say mixins, especially when used for gradients and <code>border-radius</code>, are my favourite part of LESS.</p>
<h4>4. C-style comments</h4>
<p>Some people prefer these to typical CSS inline comments. I&#8217;m OK with either, but if you&#8217;re using LESS, you can have either this:</p>
<pre class="brush: css; title: ; notranslate">/* A normal CSS comment */</pre>
<p>Or this:</p>
<pre class="brush: css; title: ; notranslate">// A C-style CSS comment</pre>
<h4>5. Nesting (in some cases)</h4>
<p>Nesting is one of those things that makes you think LESS is amazing at first. Then you start using LESS and start nesting selectors, and change your mind.</p>
<p>The rare instance where I think nesting is useful is with link states in simple selectors. In LESS you can have this:</p>
<pre class="brush: css; title: ; notranslate">a {
    :link, :visited { text-decoration:none; color:#edd273; font-weight:bold; }
    :hover, :active, :focus { color:#edd273; border-bottom:1px solid #edd273; }
}</pre>
<p>And the output will be this:</p>
<pre class="brush: css; title: ; notranslate">a:link {
  text-decoration: none;
  color: #edd273;
  font-weight: bold;
}
a:visited {
  text-decoration: none;
  color: #edd273;
  font-weight: bold;
}
a:hover {
  color: #edd273;
  border-bottom: 1px solid #edd273;
}
a:active {
  color: #edd273;
  border-bottom: 1px solid #edd273;
}
a:focus {
  color: #edd273;
  border-bottom: 1px solid #edd273;
}</pre>
<p>There&#8217;s a lot of repetition in here, I know (I&#8217;ll mention that on the next section), but it&#8217;s nice nonetheless.</p>
<h3>How LESS can easily become a nightmare</h3>
<p>This is a list of things that I would either <strong>avoid</strong> doing in LESS or that just <strong>don’t work</strong> the way you’d expect them to (so, annoyances).</p>
<h4>1. Nesting (in most cases)</h4>
<p>As I just mentioned in the previous section, nesting looks nice at first, but it doesn&#8217;t work flawlessly.</p>
<p>One of the things that I&#8217;ve noticed for example, is that, even though you can have this: </p>
<pre class="brush: css; title: ; notranslate">nav {
  ul {
    li a {
      :link { color: red; }
    }
  }
}</pre>
<p>This won&#8217;t work (notice that now I&#8217;m using a direct child selector instead):</p>
<pre class="brush: css; title: ; notranslate">nav {
  ul {
    li &gt; a {
      :link { color: red; }
    }
  }
}</pre>
<p>For this last bit of CSS to work, you&#8217;ll have to do it like this (notice the extra &#8220;&amp;&#8221;):</p>
<pre class="brush: css; title: ; notranslate">nav {
  ul {
    li &gt; a {
      &amp;:link { color: red; }
    }
  }
}</pre>
<p>This not a problem with LESS, I guess it&#8217;s just not a very intuitive way of doing it just for using a different type of selector.</p>
<p>The main thing, however, that I think makes nesting a poor choice in most cases, is how it can make <strong>a mess out of specificity</strong> [here's <a href="http://www.smashingmagazine.com/2010/04/07/css-specificity-and-inheritance/" rel="nofollow" >a post I've written previously on specificity</a> and other matters].</p>
<p>Your first instinct is to nest everything inside the main blocks, like <code>aside</code>, <code>#sidebar</code>, <code>#news</code>, etc. But then you realise you need to reutilise a piece of the CSS for another area on the site. You make another nested selector for that new block, because you don&#8217;t want to go over that first nested block of CSS that you created in the first place. You&#8217;ll be left out with numerous <strong>redundant selectors</strong>, with <strong>very long selectors</strong> (because you don&#8217;t notice this until the compiler phase), and with the need to create <strong>overly specific selectors</strong> to override your initial ones (that shouldn&#8217;t have been so specific to begin with).</p>
<p>Nesting selectors is one of those cases where the phrase &#8220;<em>with great power comes great responsibility</em>&#8221; makes a lot of sense. Use it wisely and carefully.</p>
<h4>2. Changes made to the compiled file</h4>
<p>This isn&#8217;t a problem with LESS per se, but rather with your <strong>working process</strong>.</p>
<p>Even if you are the only person in charge of the CSS on a given project, it&#8217;s possible that someday you will leave, or hand the project over to someone else, so it&#8217;s a good thing to make sure that no-one is going to edit the compiled .css file directly instead of the .less one.</p>
<p>If this happens, and then after a while someone <em>does</em> use the .less file, when it compiles, it will <strong>override the changes made</strong> to the .css file. Then you&#8217;ll have to go back and fix it.</p>
<p>This is just a general problem with people: if there&#8217;s a chance that we can make a mistake, we will make it.</p>
<h4>3. Formatting</h4>
<p>The .css file that results from the compiler gives you back your CSS with no comments and single-line declarations (that have more than one property). It would be useful if you could have some control over this. For example, you may want to minify the CSS (although you could argue that this should be a completely separate step), keep comments in, have multi-line CSS, group selectors, etc.</p>
<p>I&#8217;m not entirely sure if this has been resolved, so if someone knows better, do let me know.</p>
<h4>4. Using Firebug</h4>
<p>I can&#8217;t work without Firebug, and one of the best things about it is knowing exactly which line you&#8217;re looking at. If you&#8217;re using LESS, that&#8217;s broken: Firebug <strong>shows you the line of the compiled .css file</strong>, not the original .less file you&#8217;re editing, which is basically useless.</p>
<h3>Conclusion</h3>
<p>I love LESS and I think it&#8217;s <strong>a pleasure to use</strong>, until you start trying to be too clever and things start getting messy. My advice is to use it with care, take advantage of its niceties but don&#8217;t go overboard.</p>
<p>I know there are lot <a href="https://less.tenderapp.com/discussions/problems" rel="nofollow" >more problems</a> (and probably good things too) that I haven’t referred. These are the ones that I’ve <strong>personally</strong> came across with; I try not to use LESS on larger projects and I usually don&#8217;t use <code>@import</code> on my stylesheets (especially smaller projects) — which I know can cause some problems.</p>
<p>I’d love to know what your thoughts are on this: have you used it? Why, or why not? Which problems have you encountered? Do you find it helpful or just plain silly?</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignernotebook.com/css/my-thoughts-on-less/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>How to use Modernizr</title>
		<link>http://webdesignernotebook.com/css/how-to-use-modernizr/</link>
		<comments>http://webdesignernotebook.com/css/how-to-use-modernizr/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 08:50:47 +0000</pubDate>
		<dc:creator>Inayaili León</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://webdesignernotebook.com/?p=976</guid>
		<description><![CDATA[There is a tool that came to make our lives as progressive web designers a bit easier: Modernizr. In this short tutorial, learn how to apply this handy script to maximum effect on your sites. An overview Although CSS3’s use has been increasing among web designers, browser support for some of its features is still [...]]]></description>
			<content:encoded><![CDATA[<p>There is a tool that came to make our lives as progressive web designers a bit easier: Modernizr. In this short tutorial, learn how to apply this handy script to maximum effect on your sites.</p>
<p><span id="more-976"></span></p>
<h3>An overview</h3>
<p>Although CSS3’s use has been increasing among web designers, browser support for some of its features is still inexistent.</p>
<p>Lately, I’ve been using Modernizr more and more to cater for those <strong>browsers that don’t support specific CSS3 properties</strong>—for example, <a href="http://yaili.com" rel="nofollow" >on my site</a>—, and it makes the development much easier because I know I’m providing these lesser browsers with an alternative experience, rather than just ignoring them.</p>
<p>Bear in mind (and this is even splashed on Modernizr’s front page), that Modernizr <strong>doesn’t actually magically enable</strong> these properties for browsers that don’t support them. It just tells the page whether that feature is supported on the browser the visitor is using or not.</p>
<h3>How it works</h3>
<p>To install Modernizr, download the file from <a href="http://www.modernizr.com/" rel="nofollow" >this page</a>. Then, on your site’s head tag, add a link to the file. For example:</p>
<pre class="brush: xml; title: ; notranslate">&lt;script src=&quot;js/modernizr-1.0.min.js&quot;&gt;&lt;/script&gt;</pre>
<p>The second step is to include on your html tag a class of “<code>no-js</code>”:</p>
<pre class="brush: xml; title: ; notranslate">&lt;html class=&quot;no-js&quot;&gt;</pre>
<p><strong>Why add this tag?</strong><br />
Because that will be the default state of the page. If JavaScript (<code>js</code>) isn’t on, then Modernizr won’t work at all (and probably other features of your site won’t work either&#8230;), so it’s good that we have a <strong>fallback</strong> for that case.</p>
<p>If JavaScript is indeed enabled, once that page is loaded on the browser, that class will be replaced dynamically and it may look something like this:</p>
<pre class="brush: xml; title: ; notranslate">&lt;html class=&quot;js canvas canvastext geolocation rgba hsla no-multiplebgs borderimage borderradius boxshadow opacity no-cssanimations csscolumns no-cssgradients no-cssreflections csstransforms no-csstransforms3d no-csstransitions  video audio cufon-active fontface cufon-ready&quot;&gt;</pre>
<p><strong>What does this mean?</strong>  Let’s take a look, shall we?</p>
<p>In this case, I opened the page on Firefox 3.5. This browser (sadly) doesn’t support multiple backgrounds, CSS gradients or CSS transforms, therefore, Modernizr outputs &#8220;<code>no-multipebgs</code>&#8220;, &#8220;<code>no-cssgradients</code>&#8221; and &#8220;<code>no-csstransforms</code>&#8220;. On the other hand, it does support <code>canvas</code> and <code>border-radius</code>, which explains &#8220;<code>canvas</code>&#8221; and &#8220;<code>borderradius</code>&#8220;. Etc.</p>
<h3>How to use this (precious) information?</h3>
<p>So what can you actually do with this? How does that help you in any way?, you might ask.</p>
<p>Let’s look at an example:</p>
<h4>Multiple backgrounds</h4>
<p>Your site’s background has been carefully built and you’re using the multiple background technique to make it simpler (and faster!) to code. Your CSS may look like this:</p>
<pre class="brush: css; title: ; notranslate">#nice {
	background: url(background-one.png) top left repeat-x,
	url(background-two.png) bottom left repeat-x;
}</pre>
<p>And a nice browser will render this:</p>
<p><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2009/11/modernizr-safari.jpg" alt="modernizr-safari" title="modernizr-safari" width="241" height="342" class="alignnone size-full wp-image-1034" /></p>
<p>Using Modernizr, your CSS will look instead like this:</p>
<pre class="brush: css; title: ; notranslate">#nice {
	background: url(background-one.png) top left repeat-x;
}
.multiplebgs #nice {
	background: url(background-one.png) top left repeat-x,
	url(background-two.png) bottom left repeat-x;
}</pre>
<p>This is what your visitors will get, depending on which browser they have:</p>
<p><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2009/11/modernizr-safari.jpg" alt="modernizr-safari" title="modernizr-safari" width="241" height="342" class="alignnone size-full wp-image-1034" /> <img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2009/11/modernizr-opera.jpg" alt="modernizr-opera" title="modernizr-opera" width="241" height="342" class="alignnone size-full wp-image-1033" /></p>
<p>This is a very simplified use of Modernizr, but hopefully it&#8217;s enough to show you what you can do with it.</p>
<h3>HTML5</h3>
<p>Modernizr also allows you to <strong>use the new HTML5 elements</strong>—<code>header</code>, <code>hgroup</code>, <code>section</code>, <code>footer</code>, <code>video</code>, etc.—and style them.</p>
<p>This doesn’t mean that some of these elements will start working on Internet Explorer, but that you can <strong>style</strong> them and that IE will understand them and not ignore them.</p>
<h3>JavaScript</h3>
<p>You can also detect features using Modernizr in your JavaScript, using this syntax:</p>
<pre class="brush: jscript; title: ; notranslate">if (Modernizr.geolocation) {
}</pre>
<h3>Conclusion</h3>
<p>I hope that I managed to explain the <strong>usefulness</strong> of Modernizr. While we can’t rely on the fact that browsers support the full spectrum of features we want to use, this is the best tool out there to provide for both worlds.</p>
<p><strong>Do you use Modernizr too? How?</strong> If not, how do you deal with some browsers not supporting some features (assuming you <em>are</em> using the latest CSS3 techniques)?</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignernotebook.com/css/how-to-use-modernizr/feed/</wfw:commentRss>
		<slash:comments>84</slash:comments>
		</item>
		<item>
		<title>In Dreamweaver&#8217;s defense</title>
		<link>http://webdesignernotebook.com/tools/in-dreamweavers-defense/</link>
		<comments>http://webdesignernotebook.com/tools/in-dreamweavers-defense/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 08:30:13 +0000</pubDate>
		<dc:creator>Inayaili León</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Work Method]]></category>

		<guid isPermaLink="false">http://webdesignernotebook.com/?p=736</guid>
		<description><![CDATA[One of the things that causes me great frustration being a web designer is how my coding tool of choice is constantly looked down on. That tool is Dreamweaver. Tired of all the nasty comments that are constantly thrown at it, I&#8217;d like to explain, to those who don&#8217;t mind reading a quick rant, why [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that causes me great frustration being a web designer is how my coding tool of choice is constantly looked down on. That tool is Dreamweaver. Tired of all the nasty comments that are constantly thrown at it, I&#8217;d like to explain, to those who don&#8217;t mind reading a quick rant, why I like it. Bear with me.</p>
<p><span id="more-736"></span></p>
<h3>Attention, rant alert!</h3>
<p>First things first: not everybody that uses Dreamweaver is using it in the Design mode, or even Split mode. Or uses the automatic CSS creator/editor tool.</p>
<p>My intentions with this post are <em>not</em> to convince anyone to move from whatever tool they&#8217;re using to Dreamweaver&mdash;just to make people understand that Dreamweaver is not that little evil tool everyone seems to think it is&mdash;a tool for people who can&#8217;t code.</p>
<p>One of the reasons I wanted to get a Mac was because then I would be able to use <a href="http://www.panic.com/coda/" rel="nofollow" >Coda</a>. It looked so clean, intuitive and without all the clutter that Dreamweaver brings with it! Then I finally got my hands on to a Mac, and actually <em>tried</em> Coda: it didn&#8217;t last a day.</p>
<p>I&#8217;d like to be able to use a cooler or prettier tool, and, believe me when I say that I&#8217;ve tried a lot of them: Coda, <a href="http://macrabbit.com/espresso/" rel="nofollow" >Espresso</a>, <a href="http://www.barebones.com/products/bbedit/" rel="nofollow" >BBedit</a>, <a href="http://notepad-plus.sourceforge.net/uk/site.htm" rel="nofollow" >Notepad</a>, etc. I end up frustrated because simple things I&#8217;d like them to accomplish just aren&#8217;t there or, when they are, they&#8217;re not clear.</p>
<p>But don&#8217;t get me wrong: Dreamweaver is far from being perfect! It&#8217;s just that I&#8217;m more prepared to miss out on the great new features that keep popping from the new apps, than from the simple ones that Dreamweaver provides me with and that help me code faster.</p>
<p>I&#8217;m sorry I won&#8217;t be adding any screenshots to this post, I just have to let this out of my system as quickly as I can. :)</p>
<h3>The details that matter to me</h3>
<p>This list focuses on the way I use Dreamweaver, and that is mainly to code HTML and CSS. I&#8217;m aware that I don&#8217;t use it to its full potential, so this list could be so much longer, right?</p>
<p>So why do I like it so much then?</p>
<ul>
<li>It adds <strong>links to the external files</strong> your HTML is linking to at the top</li>
<li>The <strong>list of colours, assets, links</strong> used in a Site</li>
<li>It <strong>doesn&#8217;t close HTML tags</strong> as soon as I open then</li>
<li>It <strong>closes HTML tags</strong> if I type &#8220;<code>&lt;/</code>&#8220;</li>
<li>You get a <strong>list of all available CSS classes and ids</strong> when you&#39;re typing &quot;<code>class=</code>&quot; or &quot;<code>id=</code>&quot;</li>
<li>It <strong>auto-completes</strong> the properties in CSS files (yes, all the others probably do that as well)</li>
<li>You can <strong>add <code>strong</code>, <code>em</code>, or headings</strong>, for example, with just Cmd+B, Cmd+I, or Cmd+1</li>
<li>If you type &quot;<code>&amp;</code>&quot; in your HTML code, you get a <strong>list of glyphs</strong> available</li>
<li>It doesn&#39;t add <strong>annoying project files</strong> to my folders</li>
<li><strong>Search and replace</strong> across an entire site</li>
<li>The <strong>inbuilt FTP</strong>: it&#39;s not great, but it&#39;s OK for quick uploads</li>
<li>I can use the <strong>tab key</strong> to indent several lines of code without the need of a plug-in</li>
<li><em>Update:</em> If you set up a Site, and then change the name of a file (html, image file, etc.), it updates the links to that file within the Site</li>
<li><em>Update:</em> When inserting an <code>img</code> tag, after inserting the source file code, Dreamweaver adds the correct height and width automatically when you type in <code>height</code> and <code>width</code></li>
</ul>
<p>People keep trying to convince me to move from Dreamweaver (and sometimes I try to convince <em>myself</em>), but save your words if none of the above mentioned features is present in the tool you&#8217;re about to recommend.</p>
<p>I&#8217;d also like to add that I don&#39;t use Dreamweaver&#39;s live preview&mdash;I never got used to it because it used to suck (I&#39;ve heard it&#39;s a lot better now though), so I use a combination of Firefox and Firebug to do the live editing.</p>
<h3>The details that I don&#8217;t love, but that I can live with (or without)</h3>
<ul>
<li>The <strong>price</strong> tag. At almost £400 (or $399), it&#8217;s quite expensive and sometimes prohibitive</li>
<li>It can be <strong>slow</strong></li>
<li>It&#8217;s <strong>not as pretty</strong></li>
<li>It <strong>doesn&#8217;t know which properties have already been used</strong> for a particular tag</li>
<li><strong>Search and replace</strong> could be nicer (like Espresso&#8217;s)</li>
<li>I&#8217;d like to have a <strong>more visual navigator</strong> (like Espresso, for example), but it has one that serves its purpose well</li>
<li><strong>Spelling checker</strong>: if there is one, I don&#8217;t know where it is (Espresso has it)</li>
</ul>
<h3>Dreamweaver is sad</h3>
<p>So please, next time you say mean things about Dreamweaver, think twice, look at how sad it is:</p>
<p><img src="http://webdesignernotebook.com/wp_livesite/wp-content/uploads/2009/07/2750299656_8c89dc645a.jpg" alt="sad dog" title="sad dog" width="500" height="333" class="alignnone size-full wp-image-750" /><br /><span class="photoInfo-large">Photo by <a href="http://www.flickr.com/photos/32731319@N00/492552952/" rel="nofollow" >protographer23</a></span></p>
<p>What would you like to add? Are you a Dreamweaver hater? Do you secretly use it when no one is looking?<br />
Let me know in the comments section!</p>
]]></content:encoded>
			<wfw:commentRss>http://webdesignernotebook.com/tools/in-dreamweavers-defense/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
	</channel>
</rss>

