<?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>Ionut Staicu - Webdeveloper Blog &#187; XHTML</title>
	<atom:link href="http://dev.iamntz.com/category/cssxhtml/xhtml/feed" rel="self" type="application/rss+xml" />
	<link>http://dev.iamntz.com</link>
	<description>Stuff about CSS, XHTML, Javascript and jQuery</description>
	<lastBuildDate>Thu, 26 May 2011 05:43:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Advanced Carousel</title>
		<link>http://dev.iamntz.com/39/advanced-carousel</link>
		<comments>http://dev.iamntz.com/39/advanced-carousel#comments</comments>
		<pubDate>Thu, 31 Jul 2008 21:40:25 +0000</pubDate>
		<dc:creator>Staicu IonuÈ›-Bogdan</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://dev.iamntz.com/?p=39</guid>
		<description><![CDATA[Ok, as ai said you before, i want to make a tutorial about a more advanced carousel than previous was. I won&#8217;t explain HTML and CSS code (is very simple and intutive): Previous Next CSS file: * {margin:0;padding:0;} .clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden} &#8230; <a href="http://dev.iamntz.com/39/advanced-carousel">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ok, as ai said you before, i want to make a tutorial about a more advanced carousel than previous was. </p>
<p>I won&#8217;t explain HTML and CSS code (is very simple and intutive):</p>
<pre lang="html" line="1">
<div class="carousel">
<div class="ctrls">
		<a href="#" class="prev">Previous</a>
		<a href="#" class="next">Next</a>
	</div>
<ul class="clearfix">
<li><img src="http://farm4.static.flickr.com/3164/2719962411_77cf9e1699_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3159/2720786298_d33f97bfcd_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3280/2719962373_f49bb3e2a2_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3001/2720787742_d2f263372c_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3046/2720787680_8f358f938e_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3108/2719963843_f2e963af8f_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3141/2719965289_83902cf96c_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3164/2719962411_77cf9e1699_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3159/2720786298_d33f97bfcd_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3280/2719962373_f49bb3e2a2_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3001/2720787742_d2f263372c_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3046/2720787680_8f358f938e_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3108/2719963843_f2e963af8f_t.jpg" alt="" /></li>
<li><img src="http://farm4.static.flickr.com/3141/2719965289_83902cf96c_t.jpg" alt="" /></li>
</ul>
</div>
</pre>
<p>CSS file:</p>
<pre lang="css" line="1">
* {margin:0;padding:0;}

.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.clearfix {display:inline-block}
/* Hide from IE Mac \*/
.clearfix {display:block}
/* End hide from IE Mac */
* html .clearfix {height:1px}
.carousel {
	position: relative;
	overflow:hidden;
	height:500px;
	width:540px;
	margin:50px auto
}
	.carousel .ctrls {
		margin:10px
	}
	.carousel ul {
		position: absolute;
		width:8000px;
	}
		.carousel li {
			float:left;
			width:98px;
			height:98px;
			border: 1px solid #fff;
			list-style:none;
			margin-right:10px;
			text-align: center;
		}
</pre>
<p>The good part of this carousel is that you can have as many as you want in your page. You can have both fixed and fluid width and will work with no problem. Or at least no problem: on fluid layout, some images can be cutted. So, the best use is fixed width. Also, you can have autoscroll (with timers, i will say more later), but is not recommended because you may encounter some performance troubles.</p>
<p>After we include last version of <a href="http://jquery.com/">jQuery</a>, we have to do these things:</p>
<p>1) Iterate trough all <code>.carousel</code> containers (if you want to pick another name, this is the place and this is also the time!) and set the width. </p>
<pre lang="javascript" line="1">
$('.carousel').each(function(){
	var _this=this;
	var elWidth = $(_this).find('li:eq(0)').width()+12;
	$(_this).find('ul').width(elWidth*$(_this).find('li').length).css('left', 0);
});
</pre>
<p>We assume that all <code>LI</code> have same width, 10px margin and a border. So we adjust the width with 12 px (2px from border). If you have a wider margin (or none) change it, otherwise you will have some serious problems <img src='http://dev.iamntz.com/wp-includes/images/smilies/biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>The previous/next buttons we will control with a separate function, because we don&#8217;t have double scroll on double click, right? We put the function INSIDE of the <code>each</code> loop:</p>
<pre lang="javascript" line="1">
function carouselCtrls () {
	$(_this).find('a.prev').unbind().click(function(){
		$(this).unbind();
		if(parseInt($(_this).find('ul').css('left'))<0) {
			$(_this).find('ul').animate({
				left: '+='+elWidth
			}, function(){
				carouselCtrls();
			});
		}
		return false;
	});
	$(_this).find('a.next').unbind().click(function(){
		$(this).unbind();
		var maxWidth = (parseInt($(_this).find('ul').width())-$(_this).width()-10)-(-parseInt($(_this).find('ul').css('left')));
		if(maxWidth>0){

		$(_this).find('ul').animate({
			left: '-='+elWidth
		}, function(){
				carouselCtrls();
			});
		}else {
			$(_this).find('ul').animate({left:0},function(){
				carouselCtrls();
			});
		}
		return false;
	});
	};
</pre>
<p><!--adsense--><br />
Let see how it works (i will explain only one link because the other one works same &#8211; but reverted):<br />
<span id="more-39"></span></p>
<ol>
<li>Unbind any action from current link. This is because some users use double click on web (yes, there is some users like that!). So, once clicked, you can&#8217;t click again on the same link. Will won&#8217;t work. Seriously!</li>
<li>We verify if the carousel is scrolled, and if it is, to be scrolled enough to not be outside the area</li>
<li>Animate the carousel and call the control function after the animation is complete. After the animation is complete, you can click on the next/prev button</li>
</ol>
<p>So, the final code looks like this:</p>
<pre lang="javascript" line="1">
$('.carousel').each(function(){
	var _this=this;
	var elWidth = $(_this).find('li:eq(0)').width()+12;
	$(_this).find('ul').width(elWidth*$(_this).find('li').length).css('left', 0);
	carouselCtrls();

	function carouselCtrls () {
	$(_this).find('a.prev').unbind().click(function(){
		$(this).unbind();
		if(parseInt($(_this).find('ul').css('left'))<0) {
			$(_this).find('ul').animate({
				left: '+='+elWidth
			}, function(){
				carouselCtrls();
			});
		}
		return false;
	});
	$(_this).find('a.next').unbind().click(function(){
		$(this).unbind();
		var maxWidth = (parseInt($(_this).find('ul').width())-$(_this).width()-10)-(-parseInt($(_this).find('ul').css('left')));
		if(maxWidth>0){

		$(_this).find('ul').animate({
			left: '-='+elWidth
		}, function(){
				carouselCtrls();
			});
		}else {
			$(_this).find('ul').animate({left:0},function(){
				carouselCtrls();
			});
		}
		return false;
	});
	};
});
</pre>
<p><!--adsense--><br />
And that&#8217;s all!<br />
You can see a demo <a href="http://iamntz.com/experiments/carousel/">HERE</a>. In few days i will show you how to make a pagination on this carousel and how to make an autoscroll carousel <img src='http://dev.iamntz.com/wp-includes/images/smilies/smile.gif' alt=':)' class='wp-smiley' />  Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.iamntz.com/39/advanced-carousel/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simple carousel (slider)</title>
		<link>http://dev.iamntz.com/24/simple-carousel-slider</link>
		<comments>http://dev.iamntz.com/24/simple-carousel-slider#comments</comments>
		<pubDate>Fri, 30 May 2008 16:42:05 +0000</pubDate>
		<dc:creator>Staicu IonuÈ›-Bogdan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS/XHTML]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://dev.iamntz.com/?p=24</guid>
		<description><![CDATA[Ok, as i said before, i will make an article about what option you have when you want to use a carousel. As a jQuery user as I am, the first option i have is Sorgalla&#8217;s Carousel. It&#8217;s pretty easy &#8230; <a href="http://dev.iamntz.com/24/simple-carousel-slider">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ok, as i said before, i will make an article about what option you have when you want to use a carousel. As a jQuery user as I am, the first option i have is <a href="http://sorgalla.com/projects/jcarousel/">Sorgalla&#8217;s Carousel</a>. It&#8217;s pretty easy to use but has some disadvantages:</p>
<ul>
<li>big size &#8211; around 50k, maybe more, without another 20k for jQuery</li>
<li>some IE6 problems &#8211; yes, IE6 still has a huge market share. We still need to pull out our hair to make this piece of crap display good all pages</li>
<li>you cannot highlight current tab &#8211; if you want to use it as a tab pagination, you simply cannot highlight selected tab. Or current page.</li>
</ul>
<p>So, on an older project of mine, i wanted to use a very light script for doing this. Because i was in a really rush, i didn&#8217;t  focus on unobtrusive scripts so i put some inline javascript (yes, shame on me).</p>
<pre lang="html" line="1">
<div id="slideCtrl">
 <a class="s1 s" onclick="showSlide(1);return false;" href="#">Tab 1</a>
 <a class="s2" onclick="showSlide(2);return false;" href="#">Tab 2</a>
 <a class="s3" onclick="showSlide(3);return false;" href="#">Tab 3</a></div>
</pre>
<p>Ok, this is for control. The most important thing is that you can put this ANYWHERE in your page. For example, you can put controls on header and slider on footer of your page. Only your imagination is the limit.</p>
<p>The next thing you have to do is to put some markup:</p>
<pre lang="html" line="1">
<div id="slider">
<div class="slider">
<div class="slideWrapper">
<div class="box">Tab 1 content</div>
<div class="box">Tab 2 content</div>
<div class="box">Tab 3 content</div>
</div>

<!--/.slideWrapper--></div>

<!--/.slider--></div>

<!--/slider--></pre>
<p>This script also has some limitation:</p>
<ul>
<li>You can have only one on page;</li>
<li>Is pretty obtrusive;</li>
<li>Doesn&#8217;t do auto slide. Of course, you can set a timer for this, but i wanted an easy example.</li>
</ul>
<h3>The next thing we have to do is to set some CSS.</h3>
<p>Width and height for carousel:</p>
<pre lang="css">#slider {
	width:674px;
	height:185px;
}
</pre>
<p><span id="more-24"></span><!--adsense--><br />
The magic of this script (and also of all carousel scripts) consists in playing with position relative and position absolute:</p>
<pre lang="css">#slider .slider {
	width:660px;
	overflow:hidden;
	margin:0 auto;
	position: relative;
	height:160px;
}
#slider .slideWrapper {
	width:2640px;
	position: absolute;
	height:160px;
}
</pre>
<p>The <code>slideWrapper</code> container must have a big width: a tab width * number of tabs. If you have five tabs with 500px wide each, the slideWrapper must have around 2500px wide (even more, nobody will be upset).</p>
<p>The next thing we have to stylize is each tab-box (.box). For this, we need to float each box:</p>
<pre lang="css">#slider .box {
	width:660px;
	float:left;
	padding:20px 0;
}</pre>
<p>The result will be a wide container which has all boxes on one row. Well.. The html/css part is ends here. The next is&#8230; Javascript (or jQuery) part.</p>
<p>The most basic use is this:</p>
<pre lang="javascript">var currentslide = 1
function showSlide(nrSld) {
	currentslide = parseInt(nrSld)
	$('#slider .slideWrapper').animate({left:-660*(parseInt(nrSld)-1)})
	redrawBullets(nrSld);
};
</pre>
<p>What we do? Long story short: we move the <code>slideWrapper</code> container in its parent from left to right and from right to left, according to our needs. Simple, eh?</p>
<p>The <code>redrawBullets</code> function is for highlighting the current selection:</p>
<pre lang="javascript">function redrawBullets(slide) {
	var currentBullet = 's'+slide;
	$('#slideCtrl a').each(function(){
	$(this).removeClass('s');
	if($(this).hasClass(currentBullet)){
		$(this).addClass('s')
		}
	});
};
</pre>
<p>What do we need next? Well.. We only need to test. Here it is a <a href="http://www.iamntz.com/portfolio/writing%20school%20wp-theme/page1.html">demo </a>(is already used in a site). If you want, you can use <a href="http://gsgd.co.uk/sandbox/jquery/easing/">EaseIn </a>plugin to add some nice effects on slide.</p>
<p>We have a nice tabbed based navigation with a very cool effect which is ready to use on your site.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.iamntz.com/24/simple-carousel-slider/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>PSD HTML Slicing Tutorial</title>
		<link>http://dev.iamntz.com/18/psd-html-slicing-tutorial</link>
		<comments>http://dev.iamntz.com/18/psd-html-slicing-tutorial#comments</comments>
		<pubDate>Sun, 25 May 2008 00:58:34 +0000</pubDate>
		<dc:creator>Staicu IonuÈ›-Bogdan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS/XHTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://dev.iamntz.com/?p=18</guid>
		<description><![CDATA[Ok, as I&#8217;ve said HERE, my great psd slicing tutorial is done. Please note that it is my very first video tutorial so I&#8217;m sorry for this things: If I cut out too much parts (yes, some parts like ALT-TAB &#8230; <a href="http://dev.iamntz.com/18/psd-html-slicing-tutorial">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ok, as I&#8217;ve said HERE, my great psd slicing tutorial is done. Please note that it is my very first video tutorial so I&#8217;m sorry for this things:</p>
<ol>
<li>If I cut out too much parts (yes, some parts like ALT-TAB window, start menu showing, and so on are missing). I considered that those parts are not essential so, to reduce size, I&#8217;ve cut them out.</li>
<li>If it&#8217;s taking too long. The tutorial consists in two parts, both are around 30 minutes. I wanted to play them at 150-200% speed, but I quit. I offer a download alternative (besides the online playing), so you can download files and play them in your favorite media player with higher speed.</li>
<li>If I have language errors. English is not my native language, so I made mistakes. Some mistakes I&#8217;ve seen, some not. But it takes way to long to edit the videos again and again. I consider that errors are acceptable because the final result (which is that you understand how it&#8217;s made) is more important.</li>
</ol>
<h2>Download:</h2>
<p><a href="http://rapidshare.com/files/117389583/www.iamntz.com-PSD2HTML.slicing.tutorial.part1.wmv">Part one</a> <a href="http://rapidshare.com/files/117389592/www.iamntz.com-PSD2HTML.slicing.tutorial.part2.wmv">Part two</a>. Great for offline views.</p>
<p>Files used in movies: <a href="http://iamntz.com/experiments/slice/slicing-tutorial-www.iamntz.com.zip">HERE</a>.</p>
<p>EDIT: Because i received complains about codec and browser crash because of videos, i put only FLV version. If you prefer, under each player, you find a link for VMW version (which have waaaay better quality).</p>
<h2>Part one</h2>
<p><object width="636" height="480"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=1061707&amp;server=www.vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://www.vimeo.com/moogaloop.swf?clip_id=1061707&amp;server=www.vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="636" height="480"></embed></object></p>
<p><a href="http://dev.latest-mtv.net/play.php?id=2&#038;width=640&#038;height=480">VMW version, </a>higher quality.<br />
<!--adsense--></p>
<h2>Part two</h2>
<p><object width="636" height="480"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=1061737&amp;server=www.vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://www.vimeo.com/moogaloop.swf?clip_id=1061737&amp;server=www.vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="636" height="480"></embed></object></p>
<p><a href="http://dev.latest-mtv.net/play.php?id=3&#038;width=640&#038;height=480">VMW version, </a>higher quality.</p>
<p>I use <a href="http://www.e-texteditor.com/">E-texteditor</a>, which is THE BEST editor i ever seen, so don&#8217;t worry if things appear from nowhere. Is just my snippets.</p>
<h2>READ THIS PLEASE</h2>
<p>I really need feedback on this movies, because i want to know if i should continue or not on creating (video) tutorials. So, you like it? If you don&#8217;t like it, what was wrong? What is missing? And the most important: did you understand what&#8217;s happening there? After you did this tutorial, you are able to make this on your own?</p>
<p>Thanks and enjoy!</p>
<p>I almost forgot.<br />
The host for videos is provided by <a href="http://latest-mtv.net/">Miodrag</a>, because on my host i have limited amount of both space and bandwidth.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.iamntz.com/18/psd-html-slicing-tutorial/feed</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>How to slice a layout? Some kind of tutorial</title>
		<link>http://dev.iamntz.com/16/how-to-slice-a-layout-some-kind-of-tutorial</link>
		<comments>http://dev.iamntz.com/16/how-to-slice-a-layout-some-kind-of-tutorial#comments</comments>
		<pubDate>Sat, 24 May 2008 11:23:31 +0000</pubDate>
		<dc:creator>Staicu IonuÈ›-Bogdan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS/XHTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[Slicing]]></category>

		<guid isPermaLink="false">http://dev.iamntz.com/?p=16</guid>
		<description><![CDATA[in progress&#8230; Status: rendering first part of video. Layout: this one. I put my designer skills on work and this is what i got. I&#8217;m sure it is not the best design in the world, but i&#8217;m sure is more &#8230; <a href="http://dev.iamntz.com/16/how-to-slice-a-layout-some-kind-of-tutorial">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>in progress&#8230;</p>
<p>Status: rendering first part of video.</p>
<p>Layout: <a href="http://i126.photobucket.com/albums/p95/i0nutzb/dev/layout.png">this one</a>. I put my designer skills on work and this is what i got. I&#8217;m sure it is not the best design in the world, but i&#8217;m sure is more that we need for undestand how stuff work, right? <img src='http://dev.iamntz.com/wp-includes/images/smilies/biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>The result: <a href="http://iamntz.com/experiments/slice/">here</a>. At the end you will have the zip file with all files. PSD is included <img src='http://dev.iamntz.com/wp-includes/images/smilies/wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I hope in one hour to have first part (30 min) up &amp; running on my site. It&#8217;s about how to slice images and how to create header with top menu. In the second part, you will learn how to made the sidebar and content.</p>
<p><strong>Updates.</strong></p>
<p>I uploaded first part on google videos. Quality SUCKS! I exported with 640&#215;480 resolution and is the most HORRIBLE thing.</p>
<p>Anyway, i reconverted first part and i uploaded on Vimeo. I&#8217;m waiting to see how it&#8217;s working. The new video have around 30Mb, 30minutes and is encoded as WMV.</p>
<p>Now i&#8217;m rendering (50%) the second part of video. Wish me luck <img src='http://dev.iamntz.com/wp-includes/images/smilies/biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>You still need to stay tuned <img src='http://dev.iamntz.com/wp-includes/images/smilies/biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dev.iamntz.com/16/how-to-slice-a-layout-some-kind-of-tutorial/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>2 Column layout -Basic and advanced</title>
		<link>http://dev.iamntz.com/15/2-column-layout-basic-and-advanced</link>
		<comments>http://dev.iamntz.com/15/2-column-layout-basic-and-advanced#comments</comments>
		<pubDate>Wed, 21 May 2008 12:02:59 +0000</pubDate>
		<dc:creator>Staicu IonuÈ›-Bogdan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS/XHTML]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Layouts]]></category>

		<guid isPermaLink="false">http://dev.iamntz.com/?p=15</guid>
		<description><![CDATA[In last three days, i had at least five request for making a tutorial about CSS layouts. I also have request about slicing, but this can be wait for a while (i&#8217;m thinking seriously to make a video tutorial about &#8230; <a href="http://dev.iamntz.com/15/2-column-layout-basic-and-advanced">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In last three days, i had at least five request for making a tutorial about CSS layouts. I also have request about slicing, but this can be wait for a while (i&#8217;m thinking seriously to make a video tutorial about this; what do you think?). For now i will show you two way to get the „perfect” layout. First one is basic, easy to use and to implement and second is SEO friendly, where main content is the first thing you see when you view the source.</p>
<p>I will make examples for very basic layouts (and also most used): Header, Sidebar, Content area and Footer. </p>
<p>Here is all steps. Step 1: markup</p>
<pre lang="html" line="1">
<div id="wrap">
<div id="header">
		Header
	</div>

<!--/header-->
<div class="clearfix">
<div id="left">
			left side
		</div>

<!--/left-->
<div id="right">
			right side
		</div>

<!--/right-->
	</div>
<div id="footer">
		footer
	</div>

<!--/footer-->
</div>

<!--/wrap-->
</pre>
<p>Step 2: Floatings. We float left and right sidebar and content:</p>
<pre lang="css" line="1">
#wrap {
	width:970px;
	margin:0 auto;
	border: 1px solid #eee;
}
	#header {
		height:150px;
		border-bottom:1px solid #eee;
	}
	#left,
	#right {
		height:500px;
	}
	#left {
		width:200px;
		float:left;
		background:#f2f2f2;
	}
	#right {
		width:760px;
		float:right;
		background:#f4f4f4;
	}
</pre>
<p>Step 3: Done <img src='http://dev.iamntz.com/wp-includes/images/smilies/smile.gif' alt=':)' class='wp-smiley' />  Here is <a href="http://iamntz.com/experiments/2Column_layout/basic.html">the demo</a>. Yeah, i know, too easy, right? Sorry for that (i like to work easy <img src='http://dev.iamntz.com/wp-includes/images/smilies/tongue.gif' alt=':P' class='wp-smiley' />  )</p>
<p>The next example is just a little bit more complicated, because, as i said, the content will be the first thing in source, so the search crawler can find content more easy.</p>
<p>Step 1: Markup (with content first!)</p>
<pre lang="html" line="1">
<div id="wrap">
<div class="clearfix" id="content">
<div id="right">
			right side
		</div>

<!--/right-->
<div id="left">
			left side
		</div>

<!--/left-->
	</div>
<div id="header">
		Header
	</div>

<!--/header-->
<div id="footer">
		footer
	</div>

<!--/footer-->
</div>

<!--/wrap-->
</pre>
<p>Next step, the only need to float is the right side:</p>
<pre lang="css" line="1">
#wrap {
	width:970px;
	margin:0 auto;
	border: 1px solid #eee;
}
	#header {
		height:150px;
		border-bottom:1px solid #eee;
	}
	#left,
	#right {
		height:500px;
	}
	#left {
		width:200px;

		background:#f2f2f2;
	}
	#right {
		width:760px;
		float:right;
		background:#f4f4f4;
	}
</pre>
<p>Ok, but how do we put the header back on top? Very simple: Header needs to be absolutely positioned and the content needs to be moved a little bid lower (exactly the header height):</p>
<pre lang="css" line="1">
#header {
	height:150px;
	border-bottom:1px solid #eee;
	position: absolute;
	top:0;
}
#content {
	margin-top:150px;
}
</pre>
<p>Next step is&#8230; You guess it right! <a href="http://iamntz.com/experiments/2Column_layout/advanced.html">DEMO</a>. Again, sorry if you wanted more code to read and understand, fancy yada yada yada code and so on. I like to have a clean and easy to understand code <img src='http://dev.iamntz.com/wp-includes/images/smilies/wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Any question?</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.iamntz.com/15/2-column-layout-basic-and-advanced/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Playing with lists</title>
		<link>http://dev.iamntz.com/10/playing-with-lists</link>
		<comments>http://dev.iamntz.com/10/playing-with-lists#comments</comments>
		<pubDate>Wed, 14 May 2008 14:01:49 +0000</pubDate>
		<dc:creator>Staicu IonuÈ›-Bogdan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS/XHTML]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://dev.iamntz.com/?p=10</guid>
		<description><![CDATA[In this article we will be playing with list elements to create amazing menus. Most html menus are created using list because LI tag is the most appropiate tag for this, giving the developer posibility to play in many ways, &#8230; <a href="http://dev.iamntz.com/10/playing-with-lists">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this article we will be playing with list elements to create amazing menus. </p>
<p>Most html menus are created using list because LI tag is the most appropiate tag for this, giving the developer posibility to play in many ways, achivieng nice effects. I won&#8217;t touch the vertical lists because it&#8217;s their default display. Instead, i will cover some of horizontal lists.</p>
<h3>Basic list</h3>
<p>The basic setup for a horizontal list is to set float to list elements:</p>
<pre lang="html">
<ul id="list1">
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
<li><a href="#">Menu item 4</a></li>
</ul>
</pre>
<pre lang="css">#list1 li {
	float:left;
	list-style:none;
	margin-right:10px;
}
</pre>
<p>At this point we have a one level horizontal menu, created with list and you can see this on many (and i mean MANY) sites. Ofcourse, you can add some extra styles such as border, background (color or image) for links inside <code>LI</code> elements for getting even a nicer look. <a href="http://iamntz.com/experiments/playing-with-list/floating.html">Demo here</a>.</p>
<h3>One level drop down menu (suckerfish)</h3>
<p><span id="more-10"></span></p>
<p>The next menu i show, is a little bit more complicated, but also is more useful when you have category and sub-category. For example, imagine this blog with main category Javascript and sub-category jQuery. If i had many sub-categories, i would probably used a dropdown menu for using less space. This kind of menu is named <a href="http://www.alistapart.com/articles/dropdowns">Suckerfish (A list apart)</a>.</p>
<p>For this, we will use nested list and we will show only parents:</p>
<pre lang="html">
<ul id="list2">
<li><a href="#">Menu item 1</a>
<ul>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
</ul>
</li>
<li><a href="#">Menu item 2</a>
<ul>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
</ul>
</li>
<li><a href="#">Menu item 3</a>
<ul>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
<li><a href="#">Sub menu 1</a></li>
</ul>
</li>
<li><a href="#">Menu item 4</a></li>
</ul>
</pre>
<p>Ofcourse, we still need to float first level in the same way as we did in first example:</p>
<pre lang="css">#list2 li {
	float:left;
	list-style:none;
	margin-right:10px;
}
</pre>
<p>I said before we will hide all nested list elements, so here we go:</p>
<pre lang="css">#list2 li ul{
	display:none
}
</pre>
<p>Right now, we have a basic horizontal list. Next step is to show second level of list on hover. Because IE6 don&#8217;t know what is hover on all elements (only on <code>A</code> tag), for this browser we will use some javascript (but later).</p>
<pre lang="css">#list2 li:hover ul{
	display:block
}
</pre>
<p>Because we need to have a nice display for submenus, we have to relatively positioning main <code>LI</code> tags, so on the <code>#list2 li</code> rules add</p>
<pre lang="css">	position:relative
</pre>
<p>Also, the inner <code>UL</code> tags we need to change to:</p>
<pre lang="css">#list2 li ul{
	display:none;
	position: absolute;
	left:0;
	top:1em;
	width:150px;
}
</pre>
<p>In this point we have a very basic suckerfish menu that works on all browser except, ofcourse, IE6 <img src='http://dev.iamntz.com/wp-includes/images/smilies/biggrin.gif' alt=':D' class='wp-smiley' />  As i said before, we will make a little javascript snippet for adding or remove <code>over</code> class for LI elements. If you are using jQuery (like i do), the whole thing is easier than you think:</p>
<pre lang="javascript">	var IE6 = false /*@cc_on || @_jscript_version &lt; 5.7 @*/;
	if(IE6){$(#list2 li).hover(function(){$(this).addClass('over')}, function(){$(this).removeClass('over')})}
</pre>
<p>If you don&#8217;t want to use a javascript library (either you have a small page or you like to develop your own code), you can use next code (and add just before body tag closes):</p>
<pre lang="javascript">var IE6 = false /*@cc_on || @_jscript_version &lt; 5.7 @*/;
if(IE6){
	startList = function() {
		navRoot = document.getElementById('list2');
		for (i=0; i</pre>
<p>Well&#8230; Yes, that&#8217;s all. We only need to add an extra rule on CSS and <code>#list2 li:hover ul</code> become:</p>
<pre lang="css">	#list2 li:hover ul,
	#list2 li.over ul
</pre>
<p>At this point we have a fully functional suckerfish menu (but still with an ugly look), working on all modern browsers (even IE6). You can see the demo <a href="http://iamntz.com/experiments/playing-with-list/suckerfish.html">here</a>.</p>
<h3>Breadcrumb</h3>
<p>This one is one of my favorite toys <img src='http://dev.iamntz.com/wp-includes/images/smilies/biggrin.gif' alt=':D' class='wp-smiley' />  With this type of menu we get a &#8220;vista explorer look&#8221; breadcrumb, ready to use on your site. We will use same markup as suckerfish and also a library (i like jQuery, so i will use it)</p>
<pre lang="javascript">$(document).ready(function(){
	$('ul#list2 ul').toggle().hide();
	$('ul#list2 ul').parent('li').append('<a class="dropDown" href="#">-</a>');
	$('a.dropDown').click(function(){
		var t=this;
		$('ul#list2 ul').not($(t).parent('li').find('ul')).hide();
		$(t).parent('li').find('ul').toggle();
		$(document).unbind('click').click(function(e){
			if($(e.target).parents('ul#list2').length>1){
				$('ul#list2 ul').hide();
			}
		})

		return false;
	})
});
</pre>
<p>You can see<a href="http://iamntz.com/experiments/playing-with-list/breadcrumb.html">here</a> the demo.</p>
<p>Ofcourse, you may want to change the content for drop down links (you may want to put an arrow, your choice) for even a nicer and authentic effect.</p>
<h3>Conclusion</h3>
<p>List is so simple yet so powerful tools available for creating nice menus (the final results is up to your imagination). The final result is cross browser (yes, even IE6!), the code make sense (is semanticaly, right?) and if you don&#8217;t have javascript enabled, you can still use drop down menus (for this time not in IE6 <img src='http://dev.iamntz.com/wp-includes/images/smilies/angry.gif' alt=':(' class='wp-smiley' />  ). With a little imagination, you are able to create even nicer menus. For example, i made some time ago a scrollable menu, like iPhone menus (yes, with nested lists!). I didn&#8217;t spend too much time with it (so it won&#8217;t work too well) and i conssidered useless to post here.</p>
<p>What kind of menus do you use?</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.iamntz.com/10/playing-with-lists/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

