<?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>Webdesign, CSS, Social Media, Tech &#38; Geek Stuff &#187; code</title>
	<atom:link href="http://www.mr-mojo-risin.net/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mr-mojo-risin.net</link>
	<description>Web news, CSS and HTML tweaks, social media marketing and blog resources, geeky gadgets, mind blowing graphic sites...</description>
	<lastBuildDate>Fri, 15 Jul 2011 13:18:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CSS Mouse Over Opacity Effect</title>
		<link>http://www.mr-mojo-risin.net/2008/11/04/css-mouse-over-opacity-effect/</link>
		<comments>http://www.mr-mojo-risin.net/2008/11/04/css-mouse-over-opacity-effect/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 16:15:23 +0000</pubDate>
		<dc:creator>mr-mojo-risin</dc:creator>
				<category><![CDATA[advanced]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[graphic]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[IE6 hack]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Mouse Over]]></category>
		<category><![CDATA[mouseover]]></category>
		<category><![CDATA[Opacity]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[transparency]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://www.mr-mojo-risin.net/?p=52</guid>
		<description><![CDATA[Generally this is no rocket science, using the CSS3 attribute &#8220;opacity&#8221;, unfortunately CSS3 is not supported by many browsers. As an alternative one could use JavaScript, which also might not work everywhere (if disabled due to security measures). So the easy way only works in the latest versions of Firefox and Opera. (Take a look [...]]]></description>
			<content:encoded><![CDATA[<p>Generally this is no rocket science, using the CSS3 attribute &#8220;opacity&#8221;, unfortunately CSS3 is not supported by many browsers. As an alternative one could use JavaScript, which also might not work everywhere (if disabled due to security measures). So the easy way only works in the latest versions of Firefox and Opera.</p>
<p><a href="http://www.mr-mojo-risin.net/css-demo_001/css-demo_001.html"><img title="CSS Mouse Over Opacity Effect | css demo 01 image" src="http://www.mr-mojo-risin.net/wp-content/uploads/2008/10/css-demo_01.jpg" alt="css demo 01 CSS Mouse Over Opacity Effect" width="400" height="172" /></a></p>
<div class="cl"></div>
<p>(Take a look at a live demo <a title="CSS Mouse Over Opacity Demo" href="http://www.mr-mojo-risin.net/css-demo_001/css-demo_001.html" target="_blank">here</a>)</p>
<p>In order to get this working in all the browsers (Ok, using IE6 we&#8217;ll have to trick a little bit, but we&#8217;ll discuss this later) we have to approach this in a sneaky way.<br />
Here is a simple, fast, lean, cross browser functional and JavaScript free method, only using plain HTML, CSS and graphical elements:</p>
<p><span id="more-52"></span></p>
<p>First of all we need graphical elements, for this example only four are needed, five if including the IE6 hack:</p>
<ul>
<li>2 images of your choice to be linked</li>
<li>one graphic with transparency and color of your choice in the same size as the linked images</li>
<li>one 1px x 1px full transparent GIF</li>
</ul>
<p>You might want to download the whole demo <a title="CSS Mouse Over Opacity Demo" href="http://www.mr-mojo-risin.net/css-demo_001/demo.zip">here</a>, there the graphics are included.</p>
<p>First create the div containers including the picture links in the html document, assign a class called &#8220;image&#8221; and determine the background image, which shall be linked, by using the &#8220;style&#8221; attribute.</p>
<div class="code-example">
<pre>
&lt;div class="image"
style="background-image: url(product_01.jpg);" &gt; &lt;/div&gt;

&lt;div class="image"
style="background-image: url(product_02.jpg);" &gt; &lt;/div&gt;
</pre>
</div>
<p>[Integrating the images via "style" might be avoided by assigning "id" and referencing the image url in the css, but I needed the image to referenced in the html code for dynamic site and did not want to use the "img" tag for reasons] </p>
<p><SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822/US/mrmojorisin-20/8001/f5bc83ca-9b61-4194-b550-a5e8962794dd"> </SCRIPT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fmrmojorisin-20%2F8001%2Ff5bc83ca-9b61-4194-b550-a5e8962794dd&#038;Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT></p>
<p>After that add the links, define them using &#8220;class=&#8221;picture&#8221;, linkpath and further attributes like &#8220;title&#8221;. it should look somewhat like this:</p>
<div class="code-example">
<pre>
&lt;div class="image"
style="background-image: url(product_01.jpg);" &gt;
&lt;a href="[path]" class="picture" title="linktitle" &gt; &lt;/a&gt;
&lt;/div&gt;

&lt;div class="image"
style="background-image: url(product_02.jpg);" &gt;
&lt;a href="[path]" class="picture" title="linktitle" &gt; &lt;/a&gt;
 &lt;/div&gt;
</pre>
</div>
<p>Now the css, only two classes (+ one pseudo class) are needed:</p>
<p><strong>.image:</strong><br />
It must at least contain &#8220;background-repeat: no-repeat; border: none;&#8221; or modifications if wanted.</p>
<p><strong>a.picture</strong><br />
The size of the linked picture and the attribute &#8220;display:block;&#8221; must be indicated. The image-url for the non-active link is indicated as &#8220;background-image&#8221;, too</p>
<p><strong>a.picture:hover</strong><br />
Here the image-url for the active link is defined.</p>
<p>Now the .css file should contain the following:</p>
<div class="code-example">
<pre>
a.picture {
background: url(opacity_01.png) no-repeat;
width:183px;
height:146px;
display:block;}

a.picture:hover {
background: url(blank_01.gif) repeat;}

.image{
background-repeat: no-repeat;
border: none;}
</pre>
</div>
<p>Now you just need to align the two div containers properly as you like them to be.<br />
In this example they are floating with a margin of 10 pixels, which is done by two additional classes &#8220;l&#8221; and &#8220;m&#8221;. Why it is separated from the &#8220;image&#8221; class is explained <a href="http://www.mr-mojo-risin.net/2008/07/13/css-basic-hints/">here</a>.</p>
<p><strong>Attention!</strong></p>
<p>This works properly in every browser, but in not IE6, because here only full transparency is supported.<br />
So here&#8217;s the IE6 hack:</p>
<p>First create a new .css file named &#8220;ie6.css&#8221;, then add the following lines between the &lt;head&gt; tags of your html file:</p>
<div class="code-example">
<pre>
&lt;!--[if IE 6]&gt;
&lt;style type="text/css"&gt;@import url(ie6.css);&lt;/style&gt;
&lt;![endif]--&gt;
</pre>
</div>
<p>After that you refer to an image using only full transparency in the &#8220;a.picture&#8221; class in the &#8220;ie6.css&#8221; file, somewhat like that:</p>
<div class="code-example">
<pre>
a.picture {background: url(opacity_ie6_01.gif) no-repeat;}
</pre>
</div>
<p>&#8230;and you are done!</p>
<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F11%2F04%2Fcss-mouse-over-opacity-effect%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F11%2F04%2Fcss-mouse-over-opacity-effect%2F&amp;source=mrmojorisin&amp;style=compact&amp;service=bit.ly&amp;service_api=R_47f1cccea29760eee97be5cf0ad3e3f7&amp;hashtags=background,browser,chrome,code,css,div,effect,firefox,graphic,hint,IE6,IE6+hack,IE7,Mouse+Over,mouseover,Opacity,opera,transparency,trick&amp;b=2" height="61" width="50" title="CSS Mouse Over Opacity Effect |  image" alt=" CSS Mouse Over Opacity Effect" /><br />
			</a>
		</div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F11%2F04%2Fcss-mouse-over-opacity-effect%2F&amp;title=CSS%20Mouse%20Over%20Opacity%20Effect" id="wpa2a_2"><img src="http://www.mr-mojo-risin.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 CSS Mouse Over Opacity Effect"  title="CSS Mouse Over Opacity Effect | share save 171 16 image" /></a></p> <p><a href="http://www.mr-mojo-risin.net/?flattrss_redirect&amp;id=52&amp;md5=61ed58fc9eea0be7c75b10d2e07eedbd" title="Flattr" target="_blank"><img src="http://www.mr-mojo-risin.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mr-mojo-risin.net/2008/11/04/css-mouse-over-opacity-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.mr-mojo-risin.net/?flattrss_redirect&amp;id=52&amp;md5=61ed58fc9eea0be7c75b10d2e07eedbd" type="text/html" />"
	</item>
		<item>
		<title>CSS &#8211; some basic hints</title>
		<link>http://www.mr-mojo-risin.net/2008/07/13/css-basic-hints/</link>
		<comments>http://www.mr-mojo-risin.net/2008/07/13/css-basic-hints/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 13:20:30 +0000</pubDate>
		<dc:creator>mr-mojo-risin</dc:creator>
				<category><![CDATA[beginner]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://www.mr-mojo-risin.net/?p=8</guid>
		<description><![CDATA[CSS (cascading style sheets) is the ultimate tool to create lean, fast, functional, SEO friendly and, though, sexy layouts. Storing style attributes in one file provides several advantages as faster loading times, the source code takes a radical diet, if all the attributes do not appear on the pages itself.]]></description>
			<content:encoded><![CDATA[<p>CSS (cascading style sheets) is the ultimate tool to create lean, fast, functional, SEO friendly and, though, sexy layouts. Storing style attributes in one file provides several advantages as faster loading times, the source code takes a radical diet, if all the attributes do not appear on the pages itself.</p>
<p>You are web designer and have to work full contact with the customer? Then you will know this situation, the customer wants that headline bold and purple &#8211; no, make it green or is blue a better choice? This goes back and forth, which would make you go crazy if you had to do the changes on thousands of subpages. Using CSS you do changes faster than the customer decides between green and yellow.</p>
<p><span id="more-8"></span></p>
<p>Ok, enough chit chat here are some tricks to get more effective:</p>
<ul>
<li><strong>Assign multiple classes on one element</strong>
<p>This is a real saver, one simply creates a &#8220;virtual&#8221; class by combing several ones, which is highly flexible and lowers the amount classes you will have to use.</p>
<p><span style="text-decoration: underline;">Example:</span></p>
<p>The text should be black, underlined and bold, now instead of using a single one containing all three attributes, you setup three with each single value (black, underlined, bold)</p>
<div class="code-example2">
<pre>
&lt;style type="text/css"&gt;
.black {color: #000;}
.underlined {text-decoration: underlined;}
.bold {font-weight: bold;}
&lt;/style&gt;

&lt;span class="black underlined bold"&gt;the text&lt;/span&gt;
</pre>
</div>
<p>On the first hand this looks intricate, one could do this with a single class, but remember if you combine the three classes, you&#8217;ll get six &#8220;virtual&#8221; ones.</li>
<li><strong>Using multiple stylesheets</strong>
<p>Splitting up the a single stylesheet first of all makes it easier to maintain for the web programmer.</p>
<div class="code-example2">
<pre>&lt;style type="text/css"&gt;
@import "main.css";
@import url("additional.css");
&lt;/style&gt;</pre>
</div>
<p>It&#8217; also possible to embed further .css files into a specific .css file by integrating &#8220;@import url(&#8220;additional.css&#8221;); right at the top of the .css document.</li>
<li><strong>Abbreviations<br />
</strong><br />
As there are always many roads to reach your destination, CSS is no exception. One can shorten the CSS code to increase the clearness of the structure.<br />
<span style="text-decoration: underline;"> Example:</span><br />
Instead of:</p>
<div class="code-example2">
<pre>.classname{
margin-top: 10px;
margin-right: 15px;
margin-bottom: 20px;
margin-left: 25px;
}</pre>
</div>
<p>the abbreviated version should be used:</p>
<div class="code-example2">
.classname{margin-top: 10px 15px 20px 25px;}
</div>
<p>The order of the values is important, they are arranged clock wise:<br />
top (12 o&#8217;clock), right (3 o&#8217;clock), bottom (6 o&#8217;clock), left (9 o&#8217;clock),<br />
That also works with the attributes padding and border.<br />
<strong><br />
Compressing attribute values</strong></p>
<p>Several attributes can be concentrated in a single one.</p>
<p><span style="text-decoration: underline;">Example:</span><br />
Instead of:</p>
<div class="code-example2">
<pre>.classname{
border-width: 10px;
border-style: solid;
border-color: #000;
}</pre>
</div>
<p>Use:</p>
<div class="code-example2">
<pre>.classname{border: 10px solid #000;}</pre>
</div>
<p>This also works on &#8220;font&#8221; and &#8220;background&#8221;, i.e. .</p>
</li>
</ul>
<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F07%2F13%2Fcss-basic-hints%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F07%2F13%2Fcss-basic-hints%2F&amp;source=mrmojorisin&amp;style=compact&amp;service=bit.ly&amp;service_api=R_47f1cccea29760eee97be5cf0ad3e3f7&amp;hashtags=code,coding,css,seo,webdesign&amp;b=2" height="61" width="50" title="CSS   some basic hints |  image" alt=" CSS   some basic hints" /><br />
			</a>
		</div>
 <p><a href="http://www.mr-mojo-risin.net/?flattrss_redirect&amp;id=8&amp;md5=deb0adf415f9b8ace3bbd14d54b4239d" title="Flattr" target="_blank"><img src="http://www.mr-mojo-risin.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mr-mojo-risin.net/2008/07/13/css-basic-hints/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" href="http://www.mr-mojo-risin.net/?flattrss_redirect&amp;id=8&amp;md5=deb0adf415f9b8ace3bbd14d54b4239d" type="text/html" />"
	</item>
	</channel>
</rss>

