<?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>ServerGrove Blog &#187; css</title>
	<atom:link href="http://blog.servergrove.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.servergrove.com</link>
	<description>VPS &#38; Shared Hosting, symfony, Zend Framework, Rails, Adobe Flex, Hosting News, Web Design Tips, Webhosting and more....</description>
	<lastBuildDate>Tue, 31 Aug 2010 19:26:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simplifying CSS sprites with the sgLESSPlugin</title>
		<link>http://blog.servergrove.com/2009/12/03/simplifying-css-sprites-with-the-sglessplugin/</link>
		<comments>http://blog.servergrove.com/2009/12/03/simplifying-css-sprites-with-the-sglessplugin/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 19:29:31 +0000</pubDate>
		<dc:creator>Kim</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[less]]></category>

		<guid isPermaLink="false">http://blog.servergrove.com/?p=766</guid>
		<description><![CDATA[Using CSS sprites is a great way to speed up your web pages and web applications. The concept is simple: bundle up all your icons into one image and use the background-position property to display the correct icon. By doing this you avoid having to download multiple image files and minimize your HTTP requests. Using [...]]]></description>
			<content:encoded><![CDATA[<p>Using CSS sprites is a great way to speed up your web pages and web applications. The concept is simple: bundle up all your icons into one image and use the background-position property to display the correct icon. By doing this you avoid having to download multiple image files and minimize your HTTP requests. Using sprites is especially useful for rollovers since it avoids having to preload images altogether. An example of a CSS sprite is shown below.</p>
<p><img class="alignnone size-full wp-image-767" title="sprites" src="http://blog.servergrove.com/wp-content/uploads/2009/12/sprites.png" alt="sprites" width="140" height="160" /></p>
<p>The sprite above has all the icons laid out in a grid with the icons 20px apart. If I wanted to show the Linux penguin in a div I would use to following style:</p>
<pre class="brush: php">

.penguin {
background-image: url(sprites.png);
background-position:  -80px 0px;
}
</pre>
<p>This style rule places a     <code>background-image</code> at a position that’s -80 pixels from     the left and 0 pixels from the top. It’s simple enough with a small graphic like the one above, but when you begin using more complex sprites you need to begin doing some math, and being a designer true to my creed, I hate math. Fortunately, using LESS makes things much easier. All you have to do is setup the width and height of your grid cells like this.</p>
<pre class="brush: php">

@xwidth: 20px; //cell width
@ywidth: 20px; //cell height
</pre>
<p>Then all you need to know is the column and the row for your icon and set the background position like this:</p>
<pre class="brush: php">

background-position: @xwidth*-5 @ywidth*0; //remember the first column or row is 0
</pre>
<p>The image below illustrates the rows and columns of a sprite. the background-position property always uses a negative number when positioning a sprite.</p>
<p><img class="alignnone size-full wp-image-770" title="sprites-grid" src="http://blog.servergrove.com/wp-content/uploads/2009/12/sprites-grid.png" alt="sprites-grid" width="200" height="200" /></p>
<p>An alternative method is to set your icons in the beginning of the document like this:</p>
<pre class="brush: php">

@xwidth: 20px; //cell width
@ywidth: 20px; //cell height
@penguin: @xwidth*-5 @ywidth *0;
</pre>
<p>and then just call the css as follows:</p>
<pre class="brush: php">

background-position: @penguin;
</pre>
<p>Either way the result is the same, and as our good symfony friends from France would say, Voila! CSS sprites made simple.</p>
<p>Special thanks to Mark James for his FamFamFam icons.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.servergrove.com/2009/12/03/simplifying-css-sprites-with-the-sglessplugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips for configuring CSS in symfony</title>
		<link>http://blog.servergrove.com/2009/09/09/tips-for-configuring-css-in-symfony/</link>
		<comments>http://blog.servergrove.com/2009/09/09/tips-for-configuring-css-in-symfony/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 17:09:15 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://blog.servergrove.com/?p=552</guid>
		<description><![CDATA[Previously in this blog we talked about LESS and how it can help working with extended features in CSS. But some basic things with configuring CSS in symfony are commonly unknown. Expanded notation Stylesheets can be defined using Yaml format in view.yml. The Definitive guide to Symfony explains how to include external stylesheets in your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.servergrove.com/2009/07/30/css-symfony-plugin-with-lessphp/">Previously in this blog</a> we talked about <a href="http://lesscss.org/">LESS</a> and how it can help working with extended features in CSS. But some basic things with configuring CSS in symfony are commonly unknown.</p>
<p><strong>Expanded notation</strong><br />
Stylesheets can be defined using <a href="http://www.yaml.org/">Yaml</a> format in view.yml. The Definitive guide to Symfony explains <a href="http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer#View%20Configuration">how to include external stylesheets</a> in your pages:</p>
<pre class="brush: php">
stylesheets: [main, my]
</pre>
<p>Note that you don&#8217;t need to specify the extension .css. symfony will add it for you. There is another way to define these, which may help when dealing with many external files or extra configuration:</p>
<pre class="brush: php">
stylesheets:
                  - main.css
                  - my.css
</pre>
<p><strong> Multiple media</strong><br />
If you require to specify the media to which the stylesheet applies, it is described to do it like this:</p>
<pre class="brush: php">
stylesheets:
                  - screen.css
                  - print.css: { media: print }
</pre>
<p>What if you want to use the stylesheet for multiple media. It is not very clear and people tend to have issues defining it. Here is how:</p>
<pre class="brush: php">
stylesheets:
                  - screen.css
                  - print.css: { media: print }
                  - mobile.css: { media: &#039;handheld,screen&#039; }
</pre>
<p><strong>Conditional includes</strong><br />
Did you know you can include a stylesheet only for a specific browser? Are you thinking of IE by any chance? Here is how:</p>
<pre class="brush: php">
stylesheets:
                  - ie7.css: { condition: IE 7 }
                  - ie6.css: { condition: IE 6 }
</pre>
<p>If you have any more tips that you want to share, feel free to post a comment and share it with the community.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.servergrove.com/2009/09/09/tips-for-configuring-css-in-symfony/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS symfony plugin with LESS</title>
		<link>http://blog.servergrove.com/2009/07/30/css-symfony-plugin-with-lessphp/</link>
		<comments>http://blog.servergrove.com/2009/07/30/css-symfony-plugin-with-lessphp/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 03:11:04 +0000</pubDate>
		<dc:creator>Kim</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[less]]></category>

		<guid isPermaLink="false">http://blog.servergrove.com/?p=493</guid>
		<description><![CDATA[OK, so we were about to reinvent the wheel when Antoine Abt suggested we take a look at lessphp, a very cool project by Leaf Corcoran starting to port LESS into PHP. We bit the bait and it paid off. Leaf was super-cool about us including the lib into the symfony plugin and we released [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so we were about to reinvent the wheel when <a href="http://tonio.biz/" target="_blank">Antoine Abt</a> suggested we take a look at <a href="http://leafo.net/lessphp/" target="_blank">lessphp</a>, a very cool project by Leaf Corcoran starting to port LESS into PHP. We bit the bait and it paid off. Leaf was super-cool about us including the lib into the symfony plugin and we released a new and better plugin to use LESS in symfony. Updating the old CSS plugin with the new one using LESSphp made sense on several levels:</p>
<p>1) LESS augments CSS with some great features: variables, nested inheritance, mixins and accessors and other neat stuff.<br />
2) LESS was already a popular Ruby gem, so it&#8217;s syntax is well documented. It should be fairly easy for the symfony community to start using it.<br />
3) We are firm believers of &#8220;If something already exists and works well, don&#8217;t reinvent it.&#8221;<br />
4) Leaf had already done most of the <a href="http://leafo.net/lessphp" target="_blank">hard work</a>. Porting it to symfony was an easy task.</p>
<h3>How the plugin works</h3>
<p>Download the plugin from <a href="http://www.symfony-project.org/plugins/sgLESSPlugin">http://www.symfony-project.org/plugins/sgLESSPlugin</a> and install according to instructions. Once the plugin is installed, create a file ending with the extension .less in the /web/css folder of your application. In our case we created a file called main.less. What sgLESSPlugin will do is parse main.less and dynamically generate the output when accessed as /css/main.css, so in your view.yml, all you have to do is call:</p>
<pre class="brush: php">
1.stylesheets:    [/css/main.css]
</pre>
<h3>Using LESS</h3>
<p>The 5 main features of LESS are: variables, nested inheritance, mixins, accessors, and operations.</p>
<p><strong>Variables</strong><br />
Variables allow you to define values of specific things like colors, font-family, width etc&#8230; in one place and use them elsewhere. The syntax to use variables is:</p>
<pre class="brush: php">
@pagewidth: 960px;
@purple: #5d2458;

body {
background-color: @purple;
}

.wrapper {
width: @pagewidth;
}
</pre>
<p>The output for this will be:</p>
<pre class="brush: php">

body {
background-color: #5d2458;
}

.wrapper {
width: 960px;
}
</pre>
<p><strong>Nested inheritance</strong></p>
<p>Nested inheritance is my OCD dream come true. Instead of writing out each rule separately I can nest them in a nice neat fashion.</p>
<pre class="brush: php">

.bottomnavigation {
width: @pagewidth;
a {
color: #000;
:hover {
color: #ffcc00;
}
}
}
</pre>
<p>Becomes:</p>
<pre class="brush: php">

.bottomnavigation {
width: 960px;
}

.bottomnavigation a {
color: #000;
}

.bottomnavigation a:hover {
color: #ffcc00;
}
</pre>
<p><strong>Mixins </strong></p>
<p>Mixins are classes that allow other rules to be embedded in them.</p>
<pre class="brush: php">

.round_corners {
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;

}

#pricebox {
.rounded_corners;
}

#promobox {
.rounded_corners;
background-color: #fc0000;
}
</pre>
<p>Becomes:</p>
<pre class="brush: php">

.round_corners {
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;

}

#pricebox {
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}

#promobox {
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background-color: #fc0000;
}
</pre>
<p><strong>Accessors</strong></p>
<p>Accessors allows you to access values in other classes.</p>
<pre class="brush: php">

.article {
color: #010101;
}

.comment {
color: .article[&#039;color&#039;];
}
</pre>
<p>Becomes:</p>
<pre class="brush: php">

.article {
color: #010101;
}

.comment {
color: #010101;
}
</pre>
<p><strong>Operations</strong><br />
Operations let you add, subtract, divide and multiply property values and allow you to change multiple values proportionally. </p>
<pre class="brush: php">
@borderwidth: 2px;

.boxBorder {
border: @borderwidth * 3 solid #ccc;
}
</pre>
<p>Becomes </p>
<pre class="brush: php">

.boxBorder {
border: 6px solid #ccc;
}
</pre>
<p>That&#8217;s the simple explanation. To explore further, check out the <a href="http://leafo.net/lessphp/" target="blank">lessPHP</a> homepage or <a href="http://lesscss.org/">http://lesscss.org/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.servergrove.com/2009/07/30/css-symfony-plugin-with-lessphp/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
