<?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>Stylozero &#187; Tutorials</title>
	<atom:link href="http://stylozero.com/posts/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://stylozero.com</link>
	<description>{ design studio }</description>
	<lastBuildDate>Fri, 23 Mar 2012 14:14:16 +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>A cool hover effect for your BuddyPress members avatars</title>
		<link>http://stylozero.com/a-cool-hover-effect-for-your-buddypress-members-avatars/</link>
		<comments>http://stylozero.com/a-cool-hover-effect-for-your-buddypress-members-avatars/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 12:24:41 +0000</pubDate>
		<dc:creator>Gianfranco</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://stylozero.com/?p=176</guid>
		<description><![CDATA[This tutorial will show you how to nicely display the members names when you mouse over the avatars on your <strong>BuddyPress site</strong>.
]]></description>
			<content:encoded><![CDATA[<p>A few members at the <a href="http://buddypress.org/forums/">BuddyPress forum</a> asked me about the hover effect  I use on <a href="http://cureuphoria.com">Cureuphoria</a> to display the members names when you mouse over the avatars.</p>

<p>So I decided to write a tutorial for anyone who'd like to have the same on their BuddyPress site.</p>

<p>The image below shows an example of what the effect looks like once implemented.</p>

<img src="http://stylozero.com/site/wp-content/uploads/buddypress-hover.jpg" alt="buddypress hover effect" title="buddypress hover effect" width="239" height="317" class="frame left" />

<p>You can also see it in action <a href="http://cureuphoria.com">on the website itself</a>, of course.</p>

<p>I believe it's something pretty simple to achive, and the result is quiet practical for the user.<br />
As you suspect, it's <strong>jQuery</strong> to take care of the magic on this one.</p>
	
<p>More specifically, it's a jQuery plugin called <strong>tipsy</strong>. So, first of all, get the plugin by <a href="http://onehackoranother.com/projects/jquery/tipsy/">downloading it here</a>.</p>

<p class="clear">Once you did so, do the following:</p>

<ul>
	<li>Upload the <strong>jquery.tipsy.js</strong> file on your theme directory</li>
	<li>Put the <strong>tipsy.gif</strong> image, into the "images" folder of your theme</li>
</ul>

<p>After that, copy all the content from the <strong>tipsy.css</strong> file and paste it into your "style.css" file.</p>
<p>Than edit the background image path, in the first line:</p>

<pre>
<code>
background-image: url(images/tipsy.gif);
</code>
</pre>

<p>Now it's time to setup the jQuery stuff.</p>

<p>Open the header.php file and find this:</p>

<pre>
<code>
&lt;?php wp_head(); ?&gt; 
</code>
</pre>

<p>Replace it with:</p>

<pre>
<code>
&lt;?php wp_enqueue_script(&quot;jquery&quot;); ?&gt;
&lt;?php wp_head(); ?&gt;
&nbsp;
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php bloginfo('template_url'); ?&gt;/jquery.tipsy.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	var $j = jQuery.noConflict();
	$j(document).ready(function() {
	    $j('#members-avatars a').tipsy({gravity: 's'});
	});
&lt;/script&gt;
</code>
</pre>

<p>The <strong>wp_enqueue_script("jquery");</strong> function loads the jQuery library that is included within WordPress itself.</p>

<p>Than we load the tipsy jQuery plugin, and right after that, the script for the plugin to work;</p>

<p>Notice that we used jQuery in no-conflict mode, to avoid any possible conflict with other Javascript libraries.</p>

<p>Now, the way <strong>tipsy</strong> work is to  display a tooltip with the value of the "title" attribute of the element that you target in the script. In our case, "#members-avatars a".

<p>That implies that, as last action, you need to wrap those avatars members images with such a div with an id of "members-avatars".</p>

<p>Also, the value for the title attribute should output the name of the member, so we use the <strong>bp_member_name()</strong> function as value.</p>

<p>The whole widget code, should look something like this:</p>

<pre>
<code>
&lt;?php if ( bp_has_members('type=active&#038;max=15') ) : //members widget ?&gt;

&lt;div id=&quot;members-avatars&quot;&gt; 
    &lt;h2&gt;Members&lt;/h2&gt;
						
        &lt;?php while ( bp_members() ) : bp_the_member(); ?&gt;
		&lt;a href=&quot;&lt;?php bp_member_permalink() ?&gt;&quot; title=&quot; &lt;?php bp_member_name() ?&gt;&quot;&gt;
               &lt;?php bp_member_avatar() ?&gt;&lt;/a&gt;
	&lt;?php endwhile; ?&gt;
						
&lt;/div&gt;&lt;!-- end &quot;members-avatars&quot; --&gt;

&lt;?php endif; //members wdget ?&gt;
</code>
</pre>

<p>To make it look better, I changed the font size in the CSS code I copied from the tipsy.css from 10px to 13px. If you wish, you can also play with the opacity of the tooltip bubble in the CSS.</p>

<p>As a bonus tip, you can use the same tooltip effect on other parts of the interface, like I did for the activity main menu, for example.</p>

<img src="http://stylozero.com/site/wp-content/uploads/buddypress-hover-2.jpg" alt="" title="buddypress hover effect" width="545" height="106" class="frame center" />

<p>To achieve this, add a new target (div#members-avatars a) in the tipsy script:</p>

<pre>
<code>
&lt;script type=&quot;text/javascript&gt;
    $(document).ready(function() {
        $('div.activity-type-tabs a, div#members-avatars a').tipsy({gravity: 's'});
   });
&lt;/script&gt;
</code>
</pre>

<p>So, there you have it, simple but efficient and cool hover effect to display the members name when passing your mouse over the members avatars.</p>

<p>Feel free to implement it on your BuddyPress site!<br />
And let me know if you did use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://stylozero.com/a-cool-hover-effect-for-your-buddypress-members-avatars/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Graphical alternate-sized text with CSS</title>
		<link>http://stylozero.com/graphical-alternate-sized-text-with-css/</link>
		<comments>http://stylozero.com/graphical-alternate-sized-text-with-css/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 12:20:38 +0000</pubDate>
		<dc:creator>Gianfranco</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://stylozero.com/?p=162</guid>
		<description><![CDATA[<p>Here's a little trick about making an alternate-sized "graphical" effect with CSS, like the teaser text I used on the <a href="http://stylozero.com">homepage</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Here's a little trick about making an alternate-sized "graphical" effect with CSS, like the teaser text I used on the <a href="http://stylozero.com">homepage</a>.</p>

<img src="http://stylozero.com/site/wp-content/uploads/alternate-teaser-css.jpg" alt="" title="alternate-teaser-css" width="545" height="165" class="frame center" />

<p>The challenge here is to keep the HTML markup <strong>as clean as possible</strong> and just use CSS to style the text.</p>

<p>So, instead of assigning an id or a class to each paragraph, like so…</p>

<pre>
<code>
&lt;p id=&quot;1&quot;&gt;I am not a communication consultant.&lt;/p&gt;
&lt;p id=&quot;2&quot;&gt;I am not a project manager.&lt;/p&gt;
&lt;p id=&quot;3&quot;&gt;I am not an information architect.&lt;/p&gt;
&#8230;
</code>
</pre>

<p>…we can keep the markup clean and neat…</p>

<pre>
<code>
&lt;div id=&quot;teaser&quot;&gt;

  &lt;p&gt;I am not a &lt;em&gt;communication consultant&lt;/em&gt;.&lt;/p&gt;
  &lt;p&gt;I am not a &lt;em&gt;project manager&lt;/em&gt;.&lt;/p&gt;
  &lt;p&gt;I am not an &lt;em&gt;information architect&lt;/em&gt;.&lt;/p&gt;
  &lt;p&gt;I am not an &lt;em&gt;art director&lt;/em&gt;.&lt;/p&gt;
  &lt;p&gt;I am not a &lt;em&gt;graphic designer&lt;/em&gt;.&lt;/p&gt;
  &lt;p&gt;I am not a &lt;em&gt;web designer&lt;/em&gt;.&lt;/p&gt;
  &lt;p&gt;I am &lt;em&gt;all&lt;/em&gt; that. &lt;a href=&quot;/services&quot; title=&quot;services&quot;&gt;Pick what you need.&lt;/a&gt;&lt;/p&gt;

&lt;/div&gt;&lt;!-- end &quot;teaser&quot; --&gt;
</code>
</pre>

<p>… and make use of the + sign combinator to target each paragraph, and play with its position and size…</p>

<pre>
<code>
#teaser p { color: #666; margin-left: 40px; }
#teaser p+p { margin-left: 160px; font-size: 5em; }
#teaser p+p+p { margin-left: 105px; font-size: 3.4em; }
#teaser p+p+p+p { margin-left: 0; font-size: 3.4em; }
#teaser p+p+p+p+p { margin-left: 140px; font-size: 4em; }
#teaser p+p+p+p+p+p { margin-left: 90px; font-size: 4.5em; }
#teaser p+p+p+p+p+p+p { margin-left: 300px; font-size: 3.4em; margin-top: 30px; }

#teaser p em { color: #444; }
</code>
</pre>

<p>There you have it! A simple but clever solution to have a graphical text effect with CSS without adding any extra id's or classes to the HTML.</p>]]></content:encoded>
			<wfw:commentRss>http://stylozero.com/graphical-alternate-sized-text-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping the HTML markup flow logical</title>
		<link>http://stylozero.com/keeping-the-html-markup-flow-logical/</link>
		<comments>http://stylozero.com/keeping-the-html-markup-flow-logical/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 18:44:43 +0000</pubDate>
		<dc:creator>Gianfranco</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://stylozero.com/156/</guid>
		<description><![CDATA[<p>This is surely not going to be the ultimate article about semantics and CSS mastery, but I'd like to show how some <strong>simple observations</strong> are essential in order to build<strong> good coding habits</strong>.</p>]]></description>
			<content:encoded><![CDATA[<p>This is surely not going to be the ultimate article about semantics and CSS mastery, but I'd like to show how some <strong>simple observations</strong> are essential in order to build<strong> good coding habits</strong>.</p>

<p>A few weeks ago I worked on <a href="http://www.myfreshpackaging.com" title="My Fresh Packaging Website">this website</a>.
The agency who hired me provided me with Photoshop mockups, and I was in charge of developing the front-end code (HTML, CSS, JS) for all the different pages.</p>

<p>For the homepage there was an intro block that I needed to turn into markup and style afterword with CSS.</p>

<p>Here's a screenshot of that block…</p>
<img src="http://stylozero.com/site/wp-content/uploads/html-logical-1.jpg" alt="" title="html-logical-1" width="545" height="164" class="frame center" />

<p>While analyzing the visual mockup, the first (evil) temptation to write the HTML markup was this:</p>

<pre>
<code>
&lt;div id=&quot;intro&quot;&gt;	

   &lt;h2&gt;As a global leader in corrugated packaging, International Paper is supplying 
    a wide range of market segments in virtually all geographies.&lt;/h2&gt;

   &lt;a href=&quot;#&quot; alt=&quot;contact us&quot;&gt;Need more information? Contact us.&lt;/a&gt;

   &lt;p&gt;With over 30 years of experience in the segment, International Paper is the reliable partner 
    for all fresh fruit &amp; vegetable packaging needs. We offer our customers value-added 
    packaging solutions including supply chain and design services.&lt;/p&gt;

&lt;/div&gt;&lt;!-- end &quot;intro&quot; --&gt;
</code>
</pre>

<p>Which translates things pretty much in the order suggested by the visual presentation.</p>
<img src="http://stylozero.com/site/wp-content/uploads/html-logical-2.jpg" alt="" title="html-logical-2" width="545" height="300" class="frame center" />

<p><strong>BUT!</strong> For the sake of having a markup that <strong>respects the law of semantics</strong> and the logical flow of content whenever separated from its presentation, the ideal order should be as follow:</p>

<p><strong>Title (heading):</strong><br />
As a global leader in corrugated packaging, International Paper is supplying a wide range of market segments in virtually all geographies.</p>

<p><strong>Text (paragraphs):</strong><br />
With over 30 years of experience in the segment, International Paper is the reliable partner for all fresh fruit &#038; vegetable packaging needs. We offer our customers value-added packaging solutions including supply chain and design services.</p>

<p><strong>Call to action (link):</strong><br />
Need more information? Contact us.</p>

<p>Which assigns a different order of elements…</p>

<img src="http://stylozero.com/site/wp-content/uploads/html-logical-3.jpg" alt="" title="html-logical-3" width="545" height="300" class="frame center" />

<p>Actually, that would make more sense if you read the content <strong>stripped out of the presentational layer</strong> (CSS).
And it's never said enough that semantics should be considered above all, when coding.
You may, for instance, read the content with an RSS reader, with the result of having the title first, then the link to the action and then the text, which wouldn't look right.</p>

<p>So, the right way of coding the markup would be this:</p>

<pre>
<code>
&lt;div id=&quot;intro&quot;&gt;

   &lt;h2&gt;As a global leader in corrugated packaging, International Paper is supplying 
    a wide range of market segments in virtually all geographies.&lt;/h2&gt;

   &lt;p&gt;With over 30 years of experience in the segment, International Paper is the reliable partner 
    for all fresh fruit &amp; vegetable packaging needs. We offer our customers value-added 
    packaging solutions including supply chain and design services.&lt;/p&gt;

   &lt;a href=&quot;#&quot; alt=&quot;contact us&quot;&gt;Need more information? Contact us.&lt;/a&gt;

&lt;/div&gt;&lt;!-- end &quot;intro&quot; --&gt;
</code>
</pre>

<p>Now, to make it look like the mockup, the obvious solution to apply would be to use two basic CSS techniques: image replacement, to turn the call to action link into an image, and absolute positioning, to display the image at the right side of the title, and before the text.</p>

<pre>
<code>
#intro { position: relative; }
#intro h2 { width: 455px; }

#intro a { 
    position: absolute; 
    top: 0px; 
    right: 0px; 
    display: block; 
    width: 172px; 
    height: 70px; 
    text-indent: -9999px;
    background: url(images/intro-contact.jpg) no-repeat;
}
</code>
</pre>

<p>We now have the same presentation as on the mockup, but we kept the HTML markup logical!</p>

<p>I am sure that there are exceptions when we just can't apply simple layout techniques such as this one, without having to compromise semantics.</p>

<p>But the purpose of this article wasn't to write a CSS positioning tutorial.<br />
It was to bring the attention to the fact that writing proper markup is essential, and in order to do so you need to look at visual mockups for a little time, and interpret them the right way, instead of going to rush up and start to code.</p>

<p>Very basic practice for some, but unfortunately in my professional life I am constantly meeting coders that just don't care about such an approach.<br />
And the thing is… they just should, and there are millions of reasons why.</p>

<p><strong>Remember, logical HTML markup comes first!</strong></p>]]></content:encoded>
			<wfw:commentRss>http://stylozero.com/keeping-the-html-markup-flow-logical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

