<?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>onlyWebPro &#187; HTML &amp; CSS</title>
	<atom:link href="http://www.onlywebpro.com/category/tutorials/html-css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.onlywebpro.com</link>
	<description>For Designers &#38; Developers</description>
	<lastBuildDate>Sat, 18 May 2013 08:05:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Create Facebook App Style Slide-Out Navigation</title>
		<link>http://www.onlywebpro.com/2013/05/18/create-facebook-app-style-slide-out-na/</link>
		<comments>http://www.onlywebpro.com/2013/05/18/create-facebook-app-style-slide-out-na/#comments</comments>
		<pubDate>Sat, 18 May 2013 07:58:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=3035</guid>
		<description><![CDATA[This tutorial will show you how to build a Facebook app-like slide-out navigation for your web app using CSS &#38; JQuery.]]></description>
				<content:encoded><![CDATA[<h3>Introduction to Slide-Out Navigation (a.k.a left-hand navigation)</h3>
<p>Back to October 2011, Facebook introduced its new navigation pattern – &#8220;slide-out&#8221; navigation&#8221; which available on Facebook for iPad &amp; iPhone application. The slide-out navigation consists of a panel that slide out from left of the main content area, revealing a list of clickable items that serves as a primary navigation for the application. This navigation pattern lets developers to add permanent navigation to their application without taking up valuable screen real estate. Users can choose to reveal the navigation anytime when they need it.</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2013/12/slideout_navigation.jpg" alt="Facebook App Style Slide-Out Navigation" width="568" height="311" class="alignnone size-full wp-image-3049" /><br />
<em>Facebook navigation pattern &ndash; Slide-Out Navigation</em></p>
<p>This tutorial will show you how to build a Facebook app-like slide-out navigation for your web app using CSS &amp; JQuery.</p>
<p><a href="http://www.onlywebpro.com/demo/jquery/slideout_nav.html" class="demo_btn" target="_blank">View Demo</a></p>
<h3>HTML Markup</h3>
<p>Here is the basic HTML structure of the slide-out navigation.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body class=&quot;pushmenu-push&quot;&gt;
&lt;nav class=&quot;pushmenu pushmenu-left&quot;&gt;
	&lt;h3&gt;Welcome Peter Yee&lt;/h3&gt;
    &lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;
    &lt;a href=&quot;#&quot;&gt;Profile&lt;/a&gt;
    &lt;a href=&quot;#&quot;&gt;Games&lt;/a&gt;
    &lt;a href=&quot;#&quot;&gt;Message&lt;/a&gt;
    &lt;a href=&quot;#&quot;&gt;Settings&lt;/a&gt;
    &lt;a href=&quot;#&quot;&gt;Logout&lt;/a&gt;
&lt;/nav&gt;

&lt;div class=&quot;container&quot;&gt;
	&lt;div class=&quot;main&quot;&gt;
    	&lt;section class=&quot;buttonset&quot;&gt;
            &lt;div id=&quot;nav_list&quot;&gt;Show/Hide Left Push Menu&lt;/div&gt;
        &lt;/section&gt;
        
        &lt;section class=&quot;content&quot;&gt;
        &lt;h1&gt;Introducing Facebook Home&lt;/h1&gt;
        &lt;p&gt;Facebook Home is software for your phone designed to put your friends above everything else. You can download Facebook Home for free or purchase it pre-installed on a phone. Facebook Home works together with the Facebook for Android and Facebook Messenger apps to enable its main features:&lt;/p&gt;
        &lt;ul&gt;
        	&lt;li&gt;&lt;strong&gt;Cover feed:&lt;/strong&gt; Glance at your phone for photos and posts from your Facebook News Feed.&lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;Chat heads:&lt;/strong&gt; Send and receive texts and Facebook messages in one place. Open, close and drag chat heads around your screen to keep chatting while you’re using other apps.&lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;Notifications:&lt;/strong&gt; See news as it happens with bigger, bolder notifications on your home screen.&lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;App launcher:&lt;/strong&gt; Get right to your favorite apps and post to Facebook from the same place.&lt;/li&gt;
        &lt;/ul&gt;
        &lt;/section&gt;&lt;!-- END END content --&gt;
    &lt;/div&gt;&lt;!-- END main --&gt;
&lt;/div&gt;&lt;!-- END container --&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The body of HTML document contains a class for us to animate it. We&#8217;ve divide the document into <strong>2 main regions</strong> &ndash; <strong>navigation panel</strong> &amp; <strong>info container</strong>.</p>
<h3>The CSS</h3>
<pre class="brush: css; title: ; notranslate">
&lt;style&gt;
body {
	margin: 0;
}

.pushmenu {
	background: #3c3933;
	font-family: Arial, Helvetica, sans-serif;
	position: fixed;
	width: 240px;
	height: 100%;
	top: 0;
	z-index: 1000;
}

.pushmenu h3 {
	color: #cbbfad;
	font-size: 14px;
	font-weight: bold;
	padding: 15px 20px;
	margin: 0;
	background: #282522;	
	height: 16px;
}

.pushmenu a {
	display: block;
	color: #fff;
	font-size: 16px;
	font-weight: bold;
	text-decoration: none;
	border-top: 1px solid #57544e;
	border-bottom: 1px solid #312e2a;
	padding: 14px;
}

.pushmenu a:hover {
	background:258ecd;	
}

.pushmenu a:active {
	background: #454f5c;
	color: #fff;	
}

.pushmenu-left {
	left: -240px;	
}

.pushmenu-left.pushmenu-open {
	left: 0px;	
}

.pushmenu-push {
	overflow-x: hidden;
	position: relative;
	left: 0;	
}

.pushmenu-push-toright {
	left: 240px;	
}

/*Transition*/
.pushmenu, .pushmenu-push {
	-webkit-transition: all 0.3s ease;
	-moz-transition: all 0.3s ease;
	transition: all 0.3s ease;	
}

#nav_list {
	background: url(icon_nav.png) no-repeat left top;
	cursor: pointer;
	height: 27px;
	width: 33px;
	text-indent: -99999em;	
}

#nav_list.active {
	background-position: -33px top;	
}

.buttonset {
	background: linear-gradient(center top , #6b85b3, #334d86);
	background:-moz-linear-gradient(center top , #6b85b3, #334d86);
    background: -webkit-gradient(linear, center top, center bottom, from(#6b85b3), to(#334d86));
	height: 16px;
	padding: 10px 20px 20px;
}

section.content {
	font-family: Arial, Helvetica, sans-serif;
	padding: 10px 20px;	
}
&lt;/style&gt;
</pre>
<p>The CSS styles that we implemented is quite simple and straightforward. Basically, we just need to concentrate on these <strong>6 styles</strong> &ndash; <strong>.pushmenu</strong>, <strong>.pushmenu-left</strong>, <strong>.pushmenu-left.pushmenu-open</strong>, <strong>.pushmenu-push</strong>, <strong>#nav_list</strong> &amp; <strong>#nav_list.active</strong>.</p>
<h4>.pushmenu &amp; .pushmenu-left</h4>
<p>The navigation panel should always be accessible for the users, even if they scroll down the page. So the position of navigation panel should be fixed. That&#8217;s y we set the &#8220;position:fixed&#8221;. The &#8220;left:-240px&#8221; is set to hide the navigation panel from screen.</p>
<h4>.pushmenu-left.pushmenu-open</h4>
<p>Here we change the value of &#8220;left&#8221; property to 0, to reveal the navigation panel.</p>
<h4>.pushmenu-push</h4>
<p>We want the entire page included info container move to right when revealing the navigation panel. Here is how we apply the CSS transition property &ndash; &#8220;transition: all 0.3s ease&#8221;.</p>
<h4>#nav_list &amp; #nav_list.active</h4>
<p>This is the style for the button (3 lines button on top left). The 3 lines button icon will be changed to back arrow icon when the navigation panel revealed.</p>
<h3>JavaScript</h3>
<p>Using JavaScript to toggle class of the navigation panel, document body &amp; the 3 lines button (top left).</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
	$(document).ready(function() {
		$menuLeft = $('.pushmenu-left');
		$nav_list = $('#nav_list');
		
		$nav_list.click(function() {
			$(this).toggleClass('active');
			$('.pushmenu-push').toggleClass('pushmenu-push-toright');
			$menuLeft.toggleClass('pushmenu-open');
		});
	});
&lt;/script&gt;
</pre>
<p>Save your document and preview on your browse. You will a list of clickable items when press on top left 3 lines button and hide it when press on the back arrow button.</p>
<p><a href="http://www.onlywebpro.com/demo/jquery/slideout_nav.html" class="demo_btn" target="_blank">View Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2013/05/18/create-facebook-app-style-slide-out-na/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Build Intelligent Layout Using CSS Calc() Property</title>
		<link>http://www.onlywebpro.com/2013/04/12/build-intelligent-layout-using-css-calc-property/</link>
		<comments>http://www.onlywebpro.com/2013/04/12/build-intelligent-layout-using-css-calc-property/#comments</comments>
		<pubDate>Fri, 12 Apr 2013 06:43:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=3013</guid>
		<description><![CDATA[The <strong>CSS calc() property allows us to calculate a length value using arithmetic expression</strong>, which means we can use it to define the sizes of div, the values of padding, the widths of margin, and so forth.]]></description>
				<content:encoded><![CDATA[<h3>Introduction of CSS calc()</h3>
<p>Dynamically counting the dimension of an element is really hard for web developers. We have no way of doing any kind of dynamic unit calculations using CSS. For example, it’d be nice to be able to reserve 30% of an area plus a fixed amount of space, say 300px. Well thanks to <strong>CSS calc()</strong> property, we can do that right now using CSS.</p>
<p>The <strong>CSS calc() property allows us to calculate a length value using arithmetic expression</strong>, which means we can use it to define the sizes of div, the values of padding, the widths of margin, and so forth.</p>
<h3>Using CSS calc()</h3>
<p>The CSS calc() can be used in anywhere of CSS style-sheet. The <strong>2 main features of CSS calc()</strong> are:</p>
<ul>
<li>Mixing percentages and absolute values.</li>
<li>Mixing sizing units.</li>
</ul>
<p>Let&#8217;s take a look at the first one, &#8216;<strong>Mixing percentages and absolute values</strong>&#8216;. Let&#8217;s say, we want to create something like picture shown below:</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2013/11/css-calculation.jpg" alt="Using CSS Calc()" width="568" height="311" class="aligncenter size-full wp-image-3028" /></p>
<p>Then we could write our CSS as this:</p>
<pre class="brush: css; title: ; notranslate">
.child {
	background: #feebe8;
	margin: 0 auto;
	position: relative;
	width: -moz-calc(100% - (80px * 2));
	width: -webkit-calc(100% - (80px * 2));
	width: calc(100% - (80px *2));
}
</pre>
<p>The CSS calc() property will takes care of the proper width calculation based on .child&#8217;s parent width and minus a defined 80px padding for each sides.</p>
<p>Besides that the CSS calc() property allows us to: &ndash; &#8216;<strong>Mix sizing units</strong>&#8216;. Back in the old days, we have no way to combine two different measurements into one to get a resulting size. But now with the CSS calc() we can set the size of child element relative to, say the current font size by mixing &#8216;em&#8217; and &#8216;px&#8217; units. Example:</p>
<pre class="brush: css; title: ; notranslate">
.child {
	width: calc(1em + 5px); 	
}
</pre>
<h3>Conclusion</h3>
<p>The CSS calc() is another example of CSS taking over the role of JavaScript. It&#8217;s extremely useful when you are working on responsive layout. The calc() property is now available in Google Chrome 19, Firefox 8 or above and IE9 as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2013/04/12/build-intelligent-layout-using-css-calc-property/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Design Your Own Responsive Web Template</title>
		<link>http://www.onlywebpro.com/2013/03/18/design-your-own-responsive-web-template/</link>
		<comments>http://www.onlywebpro.com/2013/03/18/design-your-own-responsive-web-template/#comments</comments>
		<pubDate>Mon, 18 Mar 2013 16:56:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=2874</guid>
		<description><![CDATA[2012 has been a unusual year in PC market. Pc sales are lower than they were in the previous years. Accoding to the global market research company, Tablets and Smartphones sales are expected to exceed notebook in this year. Nowadays, users no longer just use desktop to view websites. They now use a variety of [...]]]></description>
				<content:encoded><![CDATA[<p>2012 has been a unusual year in PC market. Pc sales are lower than they were in the previous years. Accoding to the global market research company, Tablets and Smartphones sales are expected to exceed notebook in this year.</p>
<p>Nowadays, users no longer just use desktop to view websites. They now use a variety of different mobile devices such as iPhone, iPad, Tablets and much more. A responsive website can automatically adjust its page layout to suit the users devices. Thus giving them a best seamless experience.</p>
<p>This tutorial will shows you how to create a cross-browser responsive website with <strong>HTML5 &amp; CSS3 media queries</strong>. To newbies, responsive web design might sounds complicated, but it is actually simpler than you think.</p>
<p>Here is the screenshot of what we are going to create in this tutorial:<br />
<img src="http://www.onlywebpro.com/wp-content/uploads/2013/09/css-responsive-design1.jpg" alt="responsive design" width="568" height="911" class="alignnone size-full wp-image-2881" /></p>
<p><a class="demo_btn" target="_blank" href="http://www.onlywebpro.com/demo/css/responsive-design.html">View Responsive Design Demo</a></p>
<h3>Step 1: The HTML Strucutre</h3>
<p>Here is the HTML structure for the responsive website. In this example, we have a basic HTML5 page layout with a header, page content container, sidebar and a footer.<br />
<img src="http://www.onlywebpro.com/wp-content/uploads/2013/09/html5_layout1.jpg" alt="html5 layout" width="568" height="400" class="alignnone size-full wp-image-2882" /></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;HTML5 Responsive Demo Web Design | onlyWebPro.com&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id=&quot;site_wrapper&quot;&gt;
	&lt;header id=&quot;header&quot;&gt;
    	&lt;hgroup&gt;
        	&lt;h1&gt;Demo: HTML5 Responsive Web Design | onlyWebPro.com&lt;/h1&gt;
            &lt;h2&gt;A blog for web designers &amp;amp; web developers&lt;/h2&gt;
        &lt;/hgroup&gt;
        &lt;nav id=&quot;main_nav&quot;&gt;
        	&lt;ul&gt;
                &lt;li class=&quot;current&quot;&gt;&lt;a href=&quot;http://www.onlywebpro.com/category/html5-showcase/&quot;&gt;HTML5 Showcase&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;http://www.onlywebpro.com/category/tutorials/html-css/&quot;&gt;HTML &amp;amp; CSS Tutorial&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;http://www.onlywebpro.com/category/tutorials/javascript/&quot;&gt;JavaScript Tutorial&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;http://www.onlywebpro.com/category/tutorials/mobile-content/&quot;&gt;Mobile Content Tutorial&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;http://www.onlywebpro.com/category/tutorials/php/&quot;&gt;PHP Tutorial&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;http://www.onlywebpro.com/category/tutorials/search-engine-optimization/&quot;&gt;SEO Tutorial&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/nav&gt;
    &lt;/header&gt;&lt;!-- END header --&gt;
    
    &lt;section id=&quot;page_content&quot;&gt;
    	&lt;article&gt;
        	&lt;header&gt;
                &lt;h3&gt;HTML5 Responsive Web Design Tutorial&lt;/h3&gt;
                &lt;p&gt;Nowadays, users no longer just browse web on their desktop. Users now use mobile devices such as iPhone, iPad or Samsung Galaxy Tab to view the website. So as a web designer or web developer, we shouldn't designed the web page in fixed width anymore. This tutorial will show you how to create a cross-browser responsive design with HTML5 &amp;amp; CSS3 media queries. &lt;a href=&quot;http://www.onlywebpro.com/2013/03/18/design-your-own-responsive-web-template/&quot;&gt;Read tutorial&lt;/a&gt;
                &lt;/p&gt;
            &lt;/header&gt;
        &lt;/article&gt;&lt;!-- END article --&gt;
    &lt;/section&gt;&lt;!-- END page_content --&gt;
    
    &lt;aside id=&quot;sidebar&quot;&gt;
    	&lt;h3&gt;Follow Us&lt;/h3&gt;
        &lt;ul&gt;
        	&lt;li&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.facebook.com/pages/Connect-with-onlyWebPro/149917668368025&quot;&gt;Facebook&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.twitter.com/onlyWebPro&quot;&gt;Twitter&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://plus.google.com/100910543735224109915&quot;&gt;Google Plus&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/aside&gt;&lt;!-- END sidebar --&gt;
    
    &lt;footer&gt;
		&lt;p&gt;Copyright 2013 onlyWebPro.com&lt;/p&gt;
	&lt;/footer&gt;
&lt;/div&gt;&lt;!-- END site_wrapper --&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Step 2: Adding Meta Tag</h3>
<p>We need a viewport meta tag to tells the browser to use the device width as viewport width and disable the initial scale.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
</pre>
<h3>Step 3: Provide Fallback Support For IE</h3>
<p>HTML5 tag such as &lt;<strong>header</strong>&gt;, &lt;<strong>nav</strong>&gt;, &lt;<strong>section</strong>&gt;, &lt;<strong>article</strong>&gt;, &lt;<strong>aside</strong>&gt;, &lt;<strong>footer</strong>&gt; <strong>are not supported in Internet Explorer 8 or older</strong>, so we have to provide fallback support for users using IE.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;!--[if lt IE 9]&gt;
	&lt;script src=&quot;http://css3-mediaqueries-js.googlecode.com/files/css3-mediaqueries.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;http://html5shim.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;
&lt;![endif]--&gt;
</pre>
<h3>Step 4: The CSS</h3>
<p>The CSS for the website is simple. Note that we have divided the CSS into 3 parts: – Borwser Settings, Base Structure &amp; Navigation. I’m not going to get into the details of Browser Settings, instead we will focus on the Base Structure &amp; Navigation sections.</p>
<pre class="brush: css; title: ; notranslate">
&lt;style type=&quot;text/css&quot;&gt;
/*** Browser Settings ***/
body {
	background: #fff;
	color: #333;
	font-size: 13px;
	font-family: &quot;Lucida Sans Unicode&quot;, &quot;Lucida Grande&quot;, sans-serif;
	line-height: 1.4;
}

h1 {
	color: #000;
	font-size: 20px;
	font-weight: bold;
	margin: 0;
}

h2 {
	color: #999;
	font-size: 13px;
	font-weight: normal;
	margin: 0 0 10px;
}

h3 {
	color: #222;
	font-size: 16px;
	font-weight: bold;
	margin: 0;
}

a {
	color: #09F;
	text-decoration: none;
}

a:hover {
	color: #333;
}

/*** Base Structure ***/
#site_wrapper {
	margin: 0 auto;
	width: 90%;
}

#page_content {
	float: left;
	width: 65%;
	padding: 0 5% 3% 0;
}

#sidebar {
	float: right;
	width: 30%;
}

footer {
	clear: both;
	width: 100%;	
}

/*** Navigation ***/
#main_nav {
	position: relative;
	margin: 20px 0 40px;
}

#main_nav ul {
	margin: 0;
	padding: 0;
}

#main_nav ul li {
	display: inline-block;
	list-style-type: none;
	margin: 0 5px 10px;
	padding: 0;
}

#main_nav ul li a:hover {
	color: #333;
}

#main_nav ul li.current a {
	color: #333;
	border-radius: 5px;
}
&lt;/style&gt;
</pre>
<p>Responsive design is percentage based layout, instead of using fixed pixel value, we used percentage value for the width of all base structures.</p>
<p>We aligned the main navigation button to left by specifying &#8216;<strong>display:inline-block</strong>&#8216;.</p>
<h3>Step5: The Responsive</h3>
<p>Now here is the magic that turns our website into responsive. <strong>The CSS media queries is the key component for responsive web design</strong>, it tells the browser how to render the page for specified viewport width. If you are not familar with media queries, please be sure to read previous article on <a target="_blank" title="Media Queries For Multiple Devices" href="http://www.onlywebpro.com/2010/11/01/css3-media-queries-for-multiple-devices/">media queries</a>.</p>
<pre class="brush: css; title: ; notranslate">
&lt;style type=&quot;text/css&quot;&gt;
@media screen and (max-width: 650px) {

	#header {
		height: auto;
	}

	#page_content {
		width: auto;
		float: none;
		margin: 20px 0;
	}

	#sidebar {
		width: 100%;
		float: none;
		margin: 0;
	}
	
	/*** Navigation ***/
	#main_nav {
		position:relative;
		min-height: 30px;
	}
	
	#main_nav ul {
		background: #fff;
		border: 1px solid #ddd;
		padding: 5px 0;
		position: absolute;
		width: 40%;
	}
	
	#main_nav ul li {
		display: none;
		margin: 0;
	}
	
	#main_nav ul li.current {
		display: block;	
	}
	
	#main_nav ul li a, #main_nav ul li.current a {
		background: 0;
		display: block;
		padding: 5px 10px;
	}
	
	#main_nav ul li.current a {
		color: #333;
	}
	
	#main_nav ul:hover li {
		display: block;
	}

}
</pre>
<p>On 650px breakpoint, we removed &#8216;<strong>float</strong>&#8216; property for page content container and sidebar. We try to hide all main navigation by specifying &#8216;<strong>display:none</strong>&#8216;, but except for the &#8216;<strong>.current</strong>&#8216; button. Then when users touch / mouse over on the main naigation, we set the main navigation buttons back to &#8216;<strong>display:block</strong>&#8216;, this will turn the main navigation into a dropdown box.</p>
<p>Save all your files and view it on browser. Then resize your browser window, you should see your website automatically adjust its layout to suit your window.</p>
<h3>Conclusion</h3>
<p>You just learned how to design your own responsve web template. We hope you enjoyed this tutorial and look forward to your feedback!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2013/03/18/design-your-own-responsive-web-template/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Solving CSS Float&#8217;s Problem</title>
		<link>http://www.onlywebpro.com/2013/03/06/solving-css-float-problem/</link>
		<comments>http://www.onlywebpro.com/2013/03/06/solving-css-float-problem/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 13:40:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=2859</guid>
		<description><![CDATA[A technique to address the problem of CSS float.]]></description>
				<content:encoded><![CDATA[<p>As a web designer, we always see a problem happened when a floated element is within a container div, the floated element doesn&#8217;t automatically increase the height of the container. The main reason causing this problem is the container doesn&#8217;t contains the floated element anymore, when the element is floated.</p>
<p>Still not understand what I&#8217;m talking about? No worries, let&#8217;s take a look on the picture below:</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2013/03/problem_css_float.jpg" alt="Float Problem" title="Float Problem" width="568" height="311" class="alignnone size-full wp-image-2860" /><br />
<em>This is one of the common problem happened when using css float.</em></p>
<h3>The Solution To Fix CSS Float&#8217;s Problem</h3>
<p>Ok, here is the technique that we used to solve the problem that caused by CSS float:</p>
<pre class="brush: xml; highlight: [17,18,19,20,21,22,23,24,29]; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Solving CSS Float's Problem&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
.parent {
	background: #FC0;	
}
.right {
	float: right;	
}
.left {
	float: left;	
}

.clearfix:before,
.clearfix:after {
content: &quot; &quot;;
display: block;
}
.clearfix:after {
clear: both;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;parent clearfix&quot;&gt;
	&lt;div class=&quot;right&quot;&gt;Right Element&lt;/div&gt;
    &lt;div class=&quot;left&quot;&gt;Left Element&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>As you can see the <strong>:before</strong> and <strong>:after</strong> pseudo-elements has been used to address the problem. These pseudo-elements does exactly what the word implies. It creates a phoney element and inserts it before and after the content of the element that we’ve specified.</p>
<p>In this case, we insert a blank space before and after the parent div; and clear any float elements at the end of parent div.</p>
<p>Pretty simple right? Share this if you found this information helpful.</p>
<h4>*Update</h4>
<p>We need extra declaration to fix the CSS float&#8217;s problem in IE6 &#038; IE7:</p>
<pre class="brush: css; title: ; notranslate">
.clearfix{ *zoom:1; }
</pre>
<p><em>*Thank you for this tips Michael Shen!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2013/03/06/solving-css-float-problem/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Develop A jQuery Parallax Scrolling Framework</title>
		<link>http://www.onlywebpro.com/2013/01/28/develop-a-jquery-parallax-scrolling-framework/</link>
		<comments>http://www.onlywebpro.com/2013/01/28/develop-a-jquery-parallax-scrolling-framework/#comments</comments>
		<pubDate>Mon, 28 Jan 2013 02:15:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=2799</guid>
		<description><![CDATA[In this tutorial, we are going to shows you how to build your own Parallax Scrolling effect powered by jQuery.]]></description>
				<content:encoded><![CDATA[<h3>Introduction to Parallax Scrolling</h3>
<p>The Parallax Scrolling effect is one of the popular design trend in web industry. It is a technique to create an illusion of depth by using multiple background images that move at different speeds as the user scrolls down or up a website.</p>
<p>Still not understand how it works? Let&#8217;s check out the demo!</p>
<p><a href="http://www.onlywebpro.com/demo/jquery/parallax/parallax.html" target="_blank" class="demo_btn">View Demo</a></p>
<h3>The Concept</h3>
<p>As you viewed the demo above, the page contains 4 main content layers, which is text, bg1, bg2 and bg3. Each of these layers are given an z-index, so that the foreground layers appear above the background layers. Let&#8217;s sorting all layers in this way:</p>
<ul>
<li>bg1: The <strong>background layer</strong>.</li>
<li>bg2: The secondary background layer<strong> appears above bg1.</strong></li>
<li>bg3: This layer <strong>appear above bg2</strong>. We use it to store the main object / image.</li>
<li>text: This is the <strong>foreground layer</strong> that contains the text.</li>
</ul>
<p>As user scrolls down the page, the 4 main layers are animated independently of one another to create an illusion of depth.</p>
<h3>The HTML Markup</h3>
<p>Following is the HTML structure of our page:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;meta name=&quot;description&quot; content=&quot;Demo of building jQuery parallax scrolling framework&quot; /&gt;
&lt;title&gt;jQuery Parallax Scrolling Effects | onlyWebPro.com&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;parallax_wrapper&quot;&gt;
	&lt;div class=&quot;text&quot;&gt;
    	&lt;div id=&quot;text-1&quot;&gt;
            &lt;h1&gt;The Demo of jQuery Parallax Scrolling&lt;/h1&gt;
            &lt;p&gt;This is a demo page that shows you the simplest parallax scrolling technique you've ever came across!&lt;/p&gt;
        &lt;/div&gt;&lt;!-- END text-1 --&gt;
        &lt;div id=&quot;text-2&quot;&gt;
            &lt;h1&gt;What is Parallax Scrolling?&lt;/h1&gt;
            &lt;p&gt;Parallax scrolling is a special scrolling technique in computer graphics, wherein background images move by the camera slower than foreground images, creating an illusion of depth in a 2D video game and adding to the immersion. The technique grew out of the multiplane camera technique used in traditional animation since the 1940s, and was popularized in the 1982 arcade game Moon Patrol.&lt;/p&gt;
        &lt;/div&gt;&lt;!-- END text-2 --&gt;
        &lt;div id=&quot;text-3&quot;&gt;
            &lt;h1&gt;Example of Parallax Scrolling?&lt;/h1&gt;
            &lt;p&gt;As you scroll up / scroll down the page, all the objects are animated independently of one another to create an illusion of depth.&lt;/p&gt;
        &lt;/div&gt;&lt;!-- END text-3 --&gt;
    &lt;/div&gt;&lt;!-- END text --&gt;
    
    &lt;div class=&quot;bg3&quot;&gt;
    	&lt;img class=&quot;bg3-1&quot; src=&quot;pink.png&quot; width=&quot;370&quot; height=&quot;370&quot; /&gt;
        &lt;img class=&quot;bg3-2&quot; src=&quot;blue.png&quot; width=&quot;370&quot; height=&quot;370&quot; /&gt;
        &lt;img class=&quot;bg3-3&quot; src=&quot;green.png&quot; width=&quot;370&quot; height=&quot;370&quot; /&gt;
    &lt;/div&gt;&lt;!-- END bg3 --&gt;
    
    &lt;div class=&quot;bg2&quot;&gt;
    	&lt;img class=&quot;bg2-1&quot; src=&quot;cloud-big.png&quot; width=&quot;140&quot; height=&quot;65&quot; /&gt;
        &lt;img class=&quot;bg2-2&quot; src=&quot;cloud-big.png&quot; width=&quot;140&quot; height=&quot;65&quot; /&gt;
        &lt;img class=&quot;bg2-3&quot; src=&quot;cloud-big.png&quot; width=&quot;140&quot; height=&quot;65&quot; /&gt;
        &lt;img class=&quot;bg2-4&quot; src=&quot;cloud-big.png&quot; width=&quot;140&quot; height=&quot;65&quot; /&gt;
    &lt;/div&gt;&lt;!-- END bg2 --&gt;
    
    &lt;div class=&quot;bg1&quot;&gt;
    	&lt;img class=&quot;bg1-1&quot; src=&quot;cloud-medium.png&quot; width=&quot;86&quot; height=&quot;40&quot; /&gt;
        &lt;img class=&quot;bg1-2&quot; src=&quot;cloud-medium.png&quot; width=&quot;86&quot; height=&quot;40&quot; /&gt;
        &lt;img class=&quot;bg1-3&quot; src=&quot;cloud-medium.png&quot; width=&quot;86&quot; height=&quot;40&quot; /&gt;
        &lt;img class=&quot;bg1-4&quot; src=&quot;cloud-medium.png&quot; width=&quot;86&quot; height=&quot;40&quot; /&gt;
    &lt;/div&gt;&lt;!-- END bg1 --&gt;
&lt;/div&gt;&lt;!-- END parallax_wrapper --&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>The CSS</h3>
<p>There are 2 important CSS properties that we are going to use for creating illusion of depth for our page, which is <strong>position</strong> and <strong>z-index</strong>. Following is how our CSS code looks like:</p>
<pre class="brush: css; title: ; notranslate">
&lt;style&gt;
body {
	background: #def0fa;
	color: #333;
	font-family:Arial, Helvetica, sans-serif;
	font-size: 24px;
	line-height: 1.65;
}

h1 {
	color: #2A6360;
	font-family: Georgia, &quot;Times New Roman&quot;, Times, serif;
	font-size: 60px;
	font-weight: normal;
	line-height: 1.3;
}

/*Content*/
.text {
	z-index: 4;
	position: relative;
	width: 940px;
	margin: 0 auto;
}

.text div {
	padding: 100px 0;
	width: 500px;
}

/*Image Object*/
.bg3 {
	z-index: 3;
	position: fixed;
	left: 55%; /* align left edge with center of viewport */
	top: 0;
	width: 940px;
}

	.bg3-1 {
		position: absolute;
		top: 150px;	
	}
	
	.bg3-2 {
		position: absolute;
		top: 750px;	
	}
	
	.bg3-3 {
		position: absolute;
		top: 1350px;	
	}

/*Big Cloud*/
.bg2 {
	z-index: 2;
	position: fixed;
	top: 0;
	width: 940px;
}

	.bg2-1 {
			position: absolute;
			top: 200px;
			left: 500px;
	}
	
	.bg2-2 {
			position: absolute;
			top: 840px;
			left: 250px;
	}
	
	.bg2-3 {
			position: absolute;
			top: 460px;
			left: 130px;
	}
	
	.bg2-4 {
			position: absolute;
			top: 580px;
			left: 850px;
	}

/*Medum Cloud*/
.bg1 {
	z-index: 1;
	position: fixed;
	top: 0;
	width: 940px;
}

	.bg1-1 {
			position: absolute;
			top: 68px;
			left: 230px;
	}
	
	.bg1-2 {
			position: absolute;
			top: 540px;
			left: 750px;
	}
	
	.bg1-3 {
			position: absolute;
			top: 660px;
			left: 630px;
	}
	
	.bg1-4 {
			position: absolute;
			top: 720px;
			left: 287px;
	}
&lt;/style&gt;
</pre>
<p>As you see above, we use z-index to control the parallax effect.</p>
<p>Within each individual main layers elements are absolutely positioned. We can arrange the content in different ways according to the topic of the section.</p>
<h3>The JavaScript</h3>
<p>Ok, here is the section for us to apply some magic to our page. <img src='http://www.onlywebpro.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function() {
	$(window).bind('scroll',function(e){
    parallaxScroll();
});
 
function parallaxScroll(){
    var scrolled = $(window).scrollTop();
    $('.bg1').css('top',(0-(scrolled*.25))+'px');
    $('.bg2').css('top',(0-(scrolled*.5))+'px');
    $('.bg3').css('top',(0-(scrolled*.75))+'px');
}						   
});
&lt;/script&gt;
</pre>
<p>First of all, what we need to do is to bind a scroll event to the window object. Next, we tell the browser to run a function with named &#8220;<strong>parallaxScroll</strong>&#8221; when user scrolls down or up. Then inside the <strong>parallaxScroll</strong> function,  we get the current vertical position of the scroll bar by using <strong>.scrollTop()</strong> API, and use it for the calculation of layer&#8217;s position. So that, the foreground layer is always aligned to the top of the document, while the movement of other layers is adjusted according to their depth.</p>
<p>Save your document and view it on web browser.</p>
<p><a href="http://www.onlywebpro.com/demo/jquery/parallax/parallax.html" target="_blank" class="demo_btn">View Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2013/01/28/develop-a-jquery-parallax-scrolling-framework/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating Interactive Fictional UI With CSS3</title>
		<link>http://www.onlywebpro.com/2012/08/26/creating-interactive-fictional-ui-with-css3/</link>
		<comments>http://www.onlywebpro.com/2012/08/26/creating-interactive-fictional-ui-with-css3/#comments</comments>
		<pubDate>Sun, 26 Aug 2012 03:11:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=2461</guid>
		<description><![CDATA[In today's article we will create an interactive fiction user interface (UI) coded with CSS transforms and transition properties.]]></description>
				<content:encoded><![CDATA[<p>In today&#8217;s article we will create an interactive fiction user interface (UI) coded with CSS transforms and transition properties. The idea is to have a button and reveal more information when mouse over on it. You can check out the demo before you proceed to the next section.</p>
<p><a class="demo_btn" target="_blank" href="http://www.onlywebpro.com/demo/css/fiction-ui/fiction-ui.html">View Demo</a></p>
<p>Cool right? Let’s get started!</p>
<h3>HTML Structure</h3>
<p>We will have a simple HTML structure with several division where each one contains title and description.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Creating Interactive Fictional UI Using CSS3 | onlyWebPro&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;menu_obj home&quot;&gt;
  &lt;div class=&quot;content&quot;&gt;
    &lt;h3&gt;Home&lt;/h3&gt;
    &lt;p&gt;&lt;a href=&quot;#&quot;&gt;Read more&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;menu_obj profile&quot;&gt;
  &lt;div class=&quot;content&quot;&gt;
    &lt;h3&gt;Profile&lt;/h3&gt;
    &lt;p&gt;&lt;a href=&quot;#&quot;&gt;Read more&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;menu_obj contact&quot;&gt;
  &lt;div class=&quot;content&quot;&gt;
    &lt;h3&gt;Contact&lt;/h3&gt;
    &lt;p&gt;&lt;a href=&quot;#&quot;&gt;Read more&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>As you can see above, each menu object &#8220;menu_obj&#8221; division contains extra classes such as &#8220;home&#8221;, &#8220;profile&#8221; and &#8220;contact&#8221; that gives us freedom to define background image with CSS later. You can either create the images by yourself or use the following images:<br />
<img src="http://www.onlywebpro.com/wp-content/uploads/2012/12/icon-sprites.png" alt="Home Button" title="Home Button" width="140" height="140" class="size-full wp-image-2489" /><br />Home Button<br />
<img src="http://www.onlywebpro.com/wp-content/uploads/2012/12/icon-sprites2.png" alt="Profile Button" title="Profile Button" width="140" height="140" class="alignnone size-full wp-image-2490" /><br />Profile Button<br />
<img src="http://www.onlywebpro.com/wp-content/uploads/2012/12/icon-sprites3.png" alt="Contact Button" title="Contact Button" width="140" height="140" class="alignnone size-full wp-image-2491" /><br />Contact Button<br />
<img src="http://www.onlywebpro.com/wp-content/uploads/2012/12/icon-sprites-hover.png" alt="Hover State" title="Hover State" width="140" height="140" class="alignnone size-full wp-image-2492" /><br />Hover State</p>
<p>Ok. That&#8217;s all for the HTML structure, now, let&#8217;s take a look at the CSS styles.</p>
<h3>CSS Style</h3>
<p>Let&#8217;s define the style for each buttons and its child.</p>
<pre class="brush: css; title: ; notranslate">
&lt;style&gt;
body {
	background: #000;	
}

.menu_obj {
	border: 2px solid #104669;
	border-radius: 50%;
	box-shadow: inset 0 0 5px 3px rgba(11, 51, 74, 0.5),  0 0 2px rgba(7, 48, 74, 1);
	float: left;
	height: 125px;
	margin: 0 10px;
	position: relative;
	width: 125px;
	-webkit-transition: all 0.4s ease-in-out;
	-moz-transition: all 0.4s ease-in-out;
	-o-transition: all 0.4s ease-in-out;
	-ms-transition: all 0.4s ease-in-out;
	transition: all 0.4s ease-in-out;
}

.menu_obj.home {
	background: #060c12 url(icon-sprites.png) no-repeat center center;	
}

.menu_obj.profile {
	background: #060c12 url(icon-sprites2.png) no-repeat center center;	
}

.menu_obj.contact {
	background: #060c12 url(icon-sprites3.png) no-repeat center center;	
}

.content {
	background: #000 url(icon-sprites-hover.png) no-repeat center center;
	border-radius: 50%;
	height: inherit;
	opacity: 0;
	position: absolute;
	width: inherit;
	-webkit-transition: all 0.4s ease-in-out;
	-moz-transition: all 0.4s ease-in-out;
	-o-transition: all 0.4s ease-in-out;
	-ms-transition: all 0.4s ease-in-out;
	transition: all 0.4s ease-in-out;
	-webkit-transform: scale(0);
	-moz-transform: scale(0);
	-o-transform: scale(0);
	-ms-transform: scale(0);
	transform: scale(0);
}
.content h3 {
	color: #fff;
	cursor: default;
	font-family: 'Open Sans', Arial, sans-serif;
	font-size: 18px;
	margin: 0 10px;
	opacity: 0;
	padding: 40px 0 0 0;
	text-align: center;
	text-shadow: 0 0 10px rgba(43, 149, 205, 1);
	-webkit-transform: scale(5);
	-moz-transform: scale(5);
	-o-transform: scale(5);
	-ms-transform: scale(5);
	transform: scale(5);
	-webkit-transition: all 0.4s ease-in-out;
	-moz-transition: all 0.4s ease-in-out;
	-o-transition: all 0.4s ease-in-out;
	-ms-transition: all 0.4s ease-in-out;
	transition: all 0.4s ease-in-out;
}
.content p {
	font-family: Arial, sans-serif;
	font-size: 12px;
	margin: 10px;
	opacity: 0;
	text-align: center;
	text-shadow: 0 0 10px rgba(43, 149, 205, 1);
	-webkit-transition: all 1.6s ease-in-out;
	-moz-transition: all 1.6s ease-in-out;
	-o-transition: all 1.6s ease-in-out;
	-ms-transition: all 1.6s ease-in-out;
	transition: all 1.6s ease-in-out;
}
.content p a {
	color: #999;
	text-decoration: none;
}
.content p a:hover {
	text-decoration: underline;
}
&lt;/style&gt;
</pre>
<p>First of all, we have given the width, height for each &#8220;menu_obj&#8221;; apply inner and outer drop shadows; and define the transition type and its duration. Besides, we have given a value of 50% for &#8220;border-radius&#8221; to turn the &#8220;menu_obj&#8221; into circle. In order to make sure your code works well on every browsers, you should include vendor prefixes such as &#8220;-moz-&#8221;, &#8220;-webkit&#8221; into your code.</p>
<p>The content division of the &#8220;menu_obj&#8221; will be positioned absolutely; opacity and scale is going to be 0 for us to apply the transition later when user mouse over it.</p>
<p>The title element has scale up 5 times, and 0 opacity. We will scale it down later when user mouse over on the &#8220;menu_obj&#8221;. Same goes to the paragraph element, it has 0 opacity and a transition. Please take note on the paragraph element&#8217;s transition property, we have given 1.6 seconds to the element, to make sure the paragraph element appear after the title element.</p>
<p>Save your document now and preview it on your browser, you should get the something same like the following image.</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/12/fictional-ui.png" alt="Basic Styling For Fictional UI" title="Basic Styling For Fictional UI" width="568" height="155" class="alignnone size-full wp-image-2486" /></p>
<p>Ok, now is the interesting part, which turn our boring button into a lively and attractive one! </p>
<pre class="brush: css; title: ; notranslate">
.menu_obj:hover {
	box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.1),  0 0px 30px rgba(7, 48, 74, 1);
}
</pre>
<p>When user mouse over on the button / &#8220;menu_obj&#8221;, the button will animate its inner drop shadow&#8217;s color from blue to white with only 0.1 opacity. Meanwhile, animte its outer shadow from 2px to 30 px width.</p>
<pre class="brush: css; title: ; notranslate">
.menu_obj:hover .content {
	opacity: 1;
	-webkit-transform: scale(1);
	-moz-transform: scale(1);
	-o-transform: scale(1);
	-ms-transform: scale(1);
	transform: scale(1);
}
</pre>
<p>The content division will fade in and scale up to 1.</p>
<pre class="brush: css; title: ; notranslate">
.menu_obj:hover .content h3, .menu_obj:hover .content p {
	opacity: 1;
	-webkit-transform: scale(1);
	-moz-transform: scale(1);
	-o-transform: scale(1);
	-ms-transform: scale(1);
	transform: scale(1);
}
</pre>
<p>Lastly, the title element will fade in and scale down from 5 to 1; the paragraph element will fade in right after the appearance of title element.</p>
<p>That&#8217;s it! Save your work and check it out on your browser. You should have an animated button when mouse over on it!</p>
<p><a class="demo_btn" target="_blank" href="http://www.onlywebpro.com/demo/css/fiction-ui/fiction-ui.html">View Demo</a></p>
<h3>Conclusion</h3>
<p>You have just learned to create an interactive UI with CSS3 properties:- transform and transition. With transform and transition properties, you can have many different animation and effects, just try it out and play with it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2012/08/26/creating-interactive-fictional-ui-with-css3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handling Long Page Title of Mobile Web With Little-Known CSS Tricks</title>
		<link>http://www.onlywebpro.com/2012/07/24/handling-long-page-title-of-mobile-web-with-little-known-css-tricks/</link>
		<comments>http://www.onlywebpro.com/2012/07/24/handling-long-page-title-of-mobile-web-with-little-known-css-tricks/#comments</comments>
		<pubDate>Tue, 24 Jul 2012 02:40:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Mobile Content]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=2374</guid>
		<description><![CDATA[Here is a solution to handle long page title of mobile web with little-known CSS tricks.]]></description>
				<content:encoded><![CDATA[<h3>The Problem</h3>
<p>Sometimes, we may have a page of our mobile website or mobile app with a long title fit in the header bar as shown in the picture below. This would be make our website or app looks ugly with such 3 lines of text.</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/12/long_title.jpg" alt="Problem: The title of the page is too long." title="Problem: The title of the page is too long." width="320" height="480" class="alignnone size-full wp-image-2383" /></p>
<p><em>Problem: The title of the page is too long.</em></p>
<p>Instead, we can overcome this problem by applying some little-known CSS tricks.</p>
<h3>The Solution</h3>
<p>Here is the solution to solve the long page title. We could write the header h1 tag&#8217;s CSS as following:</p>
<pre class="brush: css; title: ; notranslate">
#header h1 {
	width: 320px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis
}
</pre>
<p>The &#8220;<strong>text-overflow: ellipsis</strong>&#8221; declaration allows us to append 3 dots to the text that doesn&#8217;t fit into the header bar. Please take note that the &#8220;<strong>text-overflow: ellipsis</strong>&#8221; only works well when you have specified the &#8220;<strong>width</strong>&#8220;, &#8220;<strong>white-space: nowrap</strong>&#8221; and &#8220;<strong>overflow:hidden</strong>&#8221; to the header h1 tag.</p>
<p>The &#8220;<strong>white-space: nowrap</strong>&#8221; here is to instruct the browser <strong>NOT </strong>to break the long text into 2 lines. Without this, the h1 will just accomodate the long text in the defined width of header bar.</p>
<p>Here is the output with the solution:</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/12/long_title_solved.jpg" alt="Solution: 3 dots appended to the end of chopped-off title." title="Solution: 3 dots appended to the end of chopped-off title." width="320" height="480" class="alignnone size-full wp-image-2384" /></p>
<p><em>Solution: 3 dots appended to the end of chopped-off title.</em></p>
<p>Pretty simple right? Share this little-known trick to your colleagues, friends and other web workers! </p>
<p>Do you have any you CSS tricks? Please do share it with us on the comment section!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2012/07/24/handling-long-page-title-of-mobile-web-with-little-known-css-tricks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Create Banner Using CSS Animation &amp; Keyframe</title>
		<link>http://www.onlywebpro.com/2012/05/27/create-banner-using-css-animation-and-keyframe/</link>
		<comments>http://www.onlywebpro.com/2012/05/27/create-banner-using-css-animation-and-keyframe/#comments</comments>
		<pubDate>Sun, 27 May 2012 09:04:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=2197</guid>
		<description><![CDATA[In this lesson, we will talk about <strong>how to create an animated web banner using CSS3 Animation &#38; Keyframe</strong>.]]></description>
				<content:encoded><![CDATA[<p>Have you ever think about creating an animated web banner using CSS3 Animation &amp; Keyframe?</p>
<p>Since the gradual disappearance of Flash in the market, currently most of the web designers &amp; web developers are using <strong>JavaScript</strong>, <strong>HTML5 </strong>and <strong>CSS </strong>technologies as an alternative for that. The <a href="http://www.onlywebpro.com/2011/06/25/html5-canvas-for-absolute-beginners-part-1/" title="Learn more about HTML5 Canvas" target="_blank">HTML5 Canvas</a> &amp; <a href="http://www.onlywebpro.com/2012/05/11/a-complete-guide-to-create-an-animated-svg-chart/" title="Read more about SVG" target="_blank">SVG </a>allow web developer to create animation and manipulate using JavaScript; The CSS allow web designer to create animation using just only CSS syntax and the designer doesn&#8217;t need to have any programming knowledge for that.</p>
<p>In this lesson, we will talk about <strong>how to create an animated web banner using CSS3 Animation &amp; Keyframe</strong>. Please take a look on the demo, to get the overview of how does the banner will look like.</p>
<p><a class="demo_btn" target="_blank" href="http://www.onlywebpro.com/demo/css/banner/css-banner.html">View Demo</a></p>
<p>If you haven’t already, please be sure to read the beginner article &ndash; <a href="http://www.onlywebpro.com/2012/04/07/create-stunning-animation-using-css3-animation-keyframe/" title="Create Stunning Animation Using CSS3 Animation &#038; Keyframe" target="_blank"><strong>&#8220;Create Stunning Animation Using CSS3 Animation &#038; Keyframe&#8221;</strong></a>.</p>
<h3>Preparing Resources</h3>
<p>The animated web banner that we are going to create is about a Flying Super Boy that will fly into the screen from left, then the banner&#8217;s title and content fade-in. So following images are required for us to create the banner, please save all images into your local drive for later use.</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/11/bottom_cloud.png" alt="Static Bottom Cloud" title="Static Bottom Cloud" width="500" height="165" class="alignnone size-full wp-image-2206" /><br />
Static Bottom Cloud</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/11/cloud01.png" alt="Moving Cloud (140x65)" title="Moving Cloud (140x65)" width="140" height="65" class="alignnone size-full wp-image-2207" /><br />
Moving Cloud (140&#215;65)</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/11/cloud02.png" alt="Moving Cloud (86x40)" title="Moving Cloud (86x40)" width="86" height="40" class="alignnone size-full wp-image-2208" /><br />
Moving Cloud (86&#215;40)</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/11/cloud03.png" alt="Moving Cloud (120x55)" title="Moving Cloud (120x55)" width="120" height="55" class="alignnone size-full wp-image-2209" /><br />
Moving Cloud (120&#215;55)</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2012/11/flyingman.gif" alt="Flying Super Boy" title="Flying Super Boy" width="150" height="100" class="alignnone size-full wp-image-2210" /><br />
Flying Super Boy</p>
<h3>The HTML Structure</h3>
<p>Once we have all the resources ready in our local drive, we will start to create the HTML document. Following is how our HTML document will look like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;head&gt;
&lt;title&gt;CSS3 Animated Web Banner | onlyWebPro.com&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id=&quot;banner_wrapper&quot;&gt;
    &lt;div id=&quot;content&quot;&gt;
        &lt;h2&gt;Need Help From Super Boy?&lt;/h2&gt;
        &lt;p&gt;&lt;a href=&quot;#&quot;&gt;Learn More&lt;/a&gt;&lt;/p&gt;
    &lt;/div&gt;&lt;!-- END content --&gt;
    
    &lt;div id=&quot;moving-clouds&quot;&gt;
        &lt;ul id=&quot;group-1&quot;&gt;
            &lt;li class=&quot;cloud-1&quot;&gt;&lt;/li&gt;
            &lt;li class=&quot;cloud-2&quot;&gt;&lt;/li&gt;
            &lt;li class=&quot;cloud-3&quot;&gt;&lt;/li&gt;
            &lt;li class=&quot;cloud-4&quot;&gt;&lt;/li&gt;
        &lt;/ul&gt;
        &lt;ul id=&quot;group-2&quot;&gt;
            &lt;li class=&quot;cloud-1&quot;&gt;&lt;/li&gt;
            &lt;li class=&quot;cloud-2&quot;&gt;&lt;/li&gt;
            &lt;li class=&quot;cloud-3&quot;&gt;&lt;/li&gt;
            &lt;li class=&quot;cloud-4&quot;&gt;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;&lt;!-- END moving-clouds --&gt;
    
    &lt;ul id=&quot;flying-man&quot;&gt;
    	&lt;li&gt;&lt;/li&gt;
    &lt;/ul&gt;&lt;!-- END flying-man --&gt;
    
    &lt;ul id=&quot;bottom-cloud&quot;&gt;
        &lt;li&gt;&lt;/li&gt;
    &lt;/ul&gt;&lt;!-- END water --&gt;
    
&lt;/div&gt;&lt;!-- END banner_wrapper --&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h4>Description:</h4>
<ul>
<li>First of all, we have to create a div with id &ndash; &#8220;<strong>banner_wrapper</strong>&#8221; as a container to hold the entire banner.</li>
<li>Place all banner title, description / content into the div with id &ndash; &#8220;<strong>content</strong>&#8220;.</li>
<li>Create a &#8220;<strong>moving-clouds</strong>&#8221; div that contain &#8220;<strong>group-1</strong>&#8221; &amp; &#8220;<strong>group-2</strong>&#8220;. We will animate the &#8220;<strong>moving-clouds</strong>&#8221; div later using CSS syntax.</li>
<li>The &#8220;<strong>group-1</strong>&#8221; &amp; &#8220;<strong>group-2</strong>&#8221; UL elements used to hold all cloud images.</li>
<li>A UL element with id &#8220;<strong>flying-man&#8221;</strong>, hold the animated GIF &ndash; Flying Super Boy.</li>
<li>We need another UL element &#8220;<strong>bottom-cloud</strong>&#8221; to hold the Static Bottom Cloud as a background for the banner.</li>
</ul>
<h3>The Basic CSS Syntax</h3>
<p>Please copy &amp; paste the following CSS and place it in the head section of HTML document.</p>
<pre class="brush: css; title: ; notranslate">
&lt;style&gt;
/*****************
Pre Settings
******************/
ul li {
	list-style-type: none;	
}

#banner_wrapper {
	background: #d1edf9;
	border: 1px solid #759BAA;
	box-shadow: 0px 0px 5px #9EC8D8;
	height: 300px;
	margin: 40px auto 0;
	overflow: hidden;
	position: relative;
	width: 500px;
}

#banner_wrapper #content {
	margin: 30px auto 0;
	text-align: center;
	position: relative;
	z-index: 2;	
}

#banner_wrapper #content h2 {
	font-family: Tahoma, Geneva, sans-serif;
    color: #137dd5;
    font-size: 50px;
	margin: 0;
	animation: delayed-fade-animation 2s 1 ease-in-out;	
	-webkit-animation: delayed-fade-animation 2s 1 ease-in-out;
    -moz-animation: delayed-fade-animation 2s 1 ease-in-out;	
}

#banner_wrapper #content p {
	font-family: &quot;Lucida Sans Unicode&quot;, &quot;Lucida Grande&quot;, sans-serif;
    color: #137dd5;
    font-size: 20px;
	animation: delayed-fade-animation 3s 1 ease-in-out;
	-webkit-animation: delayed-fade-animation 3s 1 ease-in-out;	
    -moz-animation: delayed-fade-animation 3s 1 ease-in-out;	
}

#banner_wrapper ul#flying-man {
    height: 100px;
	margin: 0;
	padding: 0;
    position: absolute;
    bottom: 25px;
    left: 20px;
	z-index: 2;
    overflow: visible;
	width: 250px;
	animation: flying-man-animation 3s 1 ease-out; 
	-webkit-animation: flying-man-animation 3s 1 ease-out; 
    -moz-animation: flying-man-animation 3s 1 ease-out; 
}

#banner_wrapper ul#flying-man li {
	background: url(images/flyingman.gif) no-repeat left top;
    height: 100px;
    position: absolute;
    bottom: 0px;
    left: 0px;
    overflow: visible;
	width: 150px;
	animation: floating-animation 1s infinite ease-in-out;
	-webkit-animation: floating-animation 1s infinite ease-in-out;
    -moz-animation: floating-animation 1s infinite ease-in-out;
}

#banner_wrapper ul#bottom-cloud li {
    width: 500px;
    height: 165px;
    background: url(images/bottom_cloud.png) no-repeat left bottom;
    z-index: 0;
    position: absolute;
    bottom: 0px;
    left: 0px;
}

#banner_wrapper #moving-clouds {
    position: absolute;
    top: 0px;
    z-index: 1;
	animation: cloud-animation 30s infinite linear; 
	-webkit-animation: cloud-animation 30s infinite linear; 
    -moz-animation: cloud-animation 30s infinite linear; 
}

#banner_wrapper #moving-clouds #group-1 {
    width:500px;
	padding: 0;
    position: absolute;
    left:0px;
}
#banner_wrapper #moving-clouds #group-2 {
    width: 500px;
	padding: 0;
    position: absolute;
    left: 500px;
}

#banner_wrapper .cloud-1 {
    width: 140px;
    height: 65px;
    background: url(images/cloud01.png) no-repeat left top;
    position: absolute;
    top: 10px;
    left: 70px;
}

#banner_wrapper .cloud-2 {
    width: 86px;
    height: 40px;
    background: url(images/cloud02.png) no-repeat left top;
    position: absolute;
    top: -25px;
    left: 300px;
}

#banner_wrapper .cloud-3 {
    width: 120px;
    height: 55px;
    background: url(images/cloud03.png) no-repeat left top;
    position: absolute;
    top: 100px;
    left: 350px;
}

#banner_wrapper .cloud-4 {
    width: 86px;
    height: 40px;
    background: url(images/cloud02.png) no-repeat left top;
    position: absolute;
    top: 75px;
    left: 10px;
}
&lt;/style&gt;
</pre>
<p>Above is the pre-setting that used to assign the images, set the position, width, height, and etc to all the HTML elements that we defined just now. I&#8217;m not going to explain it one by one, instead will just only focus on these 5 styles, which we will apply CSS Animation &#038; Keyframe syntax later: &ndash; </p>
<ul>
<li><strong>#banner_wrapper #content h2</strong>: This is the CSS style that control the appearance of the title. We have apply fade-in animation &ndash; &#8220;<strong>delayed-fade-animation</strong>&#8221; to this element.</li>
<li><strong>#banner_wrapper #content p</strong>: This style is controlling the appearance of the content. We have apply the same fade-in animation to it as well, but with longer duration. So the content will appear after the title.</li>
<li><strong>#banner_wrapper ul#flying-man</strong>: This style contain an animation &#8220;<strong>flying-man-animation</strong>&#8221; that animate the Flying Super Boy to fly into the screen from left.</li>
<li>#<strong>banner_wrapper ul#flying-man li</strong>: Another styling for Flying Super Boy that contain the floating animation &#8220;<strong>floating-animation</strong>&#8220;. This animation is repeating until the page tab / browser is close.</li>
<li><strong>#banner_wrapper #moving-clouds</strong>: The style contain the animation &#8220;<strong>cloud-animation</strong>&#8221; for the group of clouds.</li>
</ul>
<h3>The CSS Keyframe Syntax</h3>
<p>Finally, we have to create the animation using CSS Keyframe syntax. Please add the following code into the CSS section:</p>
<pre class="brush: css; title: ; notranslate">
/*****************
Animation Settings
******************/
/*CSS Standard*/
@keyframes flying-man-animation {
    0%   {left: -200px;}
    100% {left: 20px;}
}

@keyframes floating-animation {
	0% { bottom: 0px; }	
	50% { bottom: 3px; }
	100% { bottom: 0px; }
}

@keyframes delayed-fade-animation {
    0%   {opacity: 0;}
    80%  {opacity: 0;}
    100% {opacity: 1;}
}

@keyframes cloud-animation {
    0%       {left: 0px;}
    99.9999%   {left: -500px;}
    100%     {left: 0px;}
}

/*Mozilla Browser*/
@-moz-keyframes flying-man-animation {
    0%   {left: -200px;}
    100% {left: 20px;}
}

@-moz-keyframes floating-animation {
	0% { bottom: 0px; }	
	50% { bottom: 3px; }
	100% { bottom: 0px; }
}

@-moz-keyframes delayed-fade-animation {
    0%   {opacity: 0;}
    80%  {opacity: 0;}
    100% {opacity: 1;}
}

@-moz-keyframes cloud-animation {
    0%       {left: 0px;}
    99.9999%   {left: -500px;}
    100%     {left: 0px;}
}

/*Webkit Browser*/
@-webkit-keyframes flying-man-animation {
    0%   {left: -200px;}
    100% {left: 20px;}
}

@-webkit-keyframes floating-animation {
	0% { bottom: 0px; }	
	50% { bottom: 3px; }
	100% { bottom: 0px; }
}

@-webkit-keyframes delayed-fade-animation {
    0%   {opacity: 0;}
    80%  {opacity: 0;}
    100% {opacity: 1;}
}

@-webkit-keyframes cloud-animation {
    0%       {left: 0px;}
    99.9999%   {left: -500px;}
    100%     {left: 0px;}
}
</pre>
<h4>Description:</h4>
<ul>
<li>&#8220;<strong>flying-man-animation</strong>&#8220;: We have specified the keyframe to move the Flying Super Boy to fly into the screen from left by changing the value of &#8220;<strong>left</strong>&#8221; property.</li>
<li>&#8220;<strong>floating-animation</strong>&#8220;: We have specified 3 condition for the floating animation. We want the Flying Super Boy to float from bottom to top when the animation reach 50% and move down when animation is reach 100%.</li>
<li>&#8220;<strong>delayed-fade-animation</strong>&#8220;: We have specified the opacity to 1 when the animation reach 100%. This fade-in animation is applied to the title and the content of the banner.</li>
<li>&#8220;<strong>cloud-animation</strong>&#8220;: 3 condition has been specified for this animation. Since the &#8220;<strong>group-1</strong>&#8221; cloud &amp; &#8220;<strong>group-2</strong>&#8221; clouds is in same formation and width (500px), if we want the seamlessly looping animation, we must make sure the position of the &#8220;<strong>moving-clouds</strong>&#8221; is at -500px when the animation reach 99.999%.</li>
</ul>
<p>Save your document and view it in supported browser, such as Firefox, Chrome and Safari!</p>
<h3>Conclusion</h3>
<p>The CSS Animation &amp; Keyframe syntax allow us to create web animation without requires any programming knowledge such as JavaScript or Flash Action Script.</p>
<p><a class="demo_btn" target="_blank" href="http://www.onlywebpro.com/demo/css/banner/css-banner.html">View Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2012/05/27/create-banner-using-css-animation-and-keyframe/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Create Stunning Animation Using CSS3 Animation &amp; Keyframe</title>
		<link>http://www.onlywebpro.com/2012/04/07/create-stunning-animation-using-css3-animation-keyframe/</link>
		<comments>http://www.onlywebpro.com/2012/04/07/create-stunning-animation-using-css3-animation-keyframe/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 00:01:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=2072</guid>
		<description><![CDATA[Usually, web designer will create animation using language like JavaScript, but now, web designer can create smooth, maintainable animation more easily using CSS3 Animation &#38; Keyframe. The syntax of CSS3 Animation &#38; Keyframe is extremely easy to understand, and don't requires any programming knowledge. In this tutorial, we will cover the syntax of CSS3 Animation &#38; Keyframe; and we will create a simple spinning newspaper using the syntax that we have learned. Please check out the demo, before we start the tutorial.]]></description>
				<content:encoded><![CDATA[<p>Usually, web designer will create animation using language like JavaScript, but now, web designer can create smooth, maintainable animation more easily using CSS3 Animation &amp; Keyframe. The syntax of CSS3 Animation &amp; Keyframe is extremely easy to understand, and don&#8217;t requires any programming knowledge. In this tutorial, we will cover the syntax of CSS3 Animation &amp; Keyframe; and we will create a simple spinning newspaper using the syntax that we have learned. Please check out the demo, before we start the tutorial.</p>
<p><a class="demo_btn" target="_blank" href="http://www.onlywebpro.com/demo/css/keyframe.html">View Demo</a></p>
<h3>The Syntax of CSS3 Animation</h3>
<p>There are six properties available for the CSS3 Animation properties.</p>
<ul>
<li><strong>animation-name </strong>- This property is used to specify name of the keyframe that you are going to use. You can put any name as you like.</li>
<li><strong>animation-duration</strong> &#8211; Specifies the time (in milliseconds format) an animation takes to complete.</li>
<li><strong>animation-timing-function</strong> &#8211; Specifies the speed curve of the animation</li>
<li><strong>animation-delay</strong> &#8211; Specifies the time for before an animation will start.</li>
<li><strong>animation-iteration-count</strong> &#8211; Specifies how many times an animation should be played.</li>
<li><strong>animation-direction </strong>- Specifies whether or not the animation should play in reverse.</li>
</ul>
<h3>Setup Essential Elements</h3>
<p>Let&#8217;s setup the environment by creating a div that contain an image of newspaper:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Create Stunning Animation Using CSS3 Animation And Keyframe | onlyWebPro&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;viewport&quot;&gt;
&lt;div class=&quot;box1&quot;&gt;&lt;img src=&quot;newspaper.jpg&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>There are 3 elements here &#8211; <strong>viewport</strong>, <strong>box1</strong> and an <strong>image</strong> file. Viewport is used to set visibility area of our animation; box1 is the div that hold the newspaper image; image file is the image source of newspaper. Note: You are free to use the following image created by onlyWebPro.com for this tutorial.<br />
<img src="http://www.onlywebpro.com/wp-content/uploads/2012/09/newspaper.jpg" alt="onlyWebPro spinning newspaper animation" title="onlyWebPro spinning newspaper animation" width="468" height="330" class="alignnone size-full wp-image-2108" /></p>
<p>Next, let&#8217;s style all the elements using CSS. </p>
<pre class="brush: xml; title: ; notranslate">
&lt;style&gt;
.viewport {
	width: 468px;
	height: 330px;
	margin: 0 auto;
}

.box1 img {
width:468px;
height:330px;
}
&lt;/style&gt;
</pre>
<p><strong>Description:</strong></p>
<ul>
<li><strong>viewport </strong>- We have set  the visibility area to width: 468px, height: 330px and align it to the center of the browser.</li>
<li><strong>box1 img</strong> &#8211; We have also set the height and width of the image that same to the viewport. We will animate the newspaper later using these 2 properties.</li>
</ul>
<h3>Creating Animation</h3>
<p>It&#8217;s time to make the newspaper spinning using the syntax of CSS3 Animation that we have just learned. Specifies the properties of the animation name, duration, timing function, delay, iteration and direction. <strong>Note</strong>: Firefox requires the prefix -moz-, while Chrome and Safari require the prefix -webkit-.</p>
<pre class="brush: xml; highlight: [23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47]; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Create Stunning Animation Using CSS3 Animation And Keyframe | onlyWebPro&lt;/title&gt;

&lt;style&gt;
body {
	overflow: hidden;	
}

.viewport {
	width: 468px;
	height: 330px;
	margin: 0 auto;
}

.box1 img {
width:468px;
height:330px;
background:rgba(255,0,0,0.5);

animation-name: spinning;
-moz-animation-name:spinning;
-webkit-animation-name:spinning;

animation-duration: 1s;
-moz-animation-duration: 1s;
-webkit-animation-duration: 1s;

animation-timing-function: ease;
-moz-animation-timing-function: ease;
-webkit-animation-timing-function: ease;

animation-delay: 0;
-moz-animation-delay: 0;
-webkit-animation-delay: 0;

animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
-webkit-animation-iteration-count: 1;

animation-direction: normal;
-moz-animation-direction: normal;
-webkit-animation-direction: normal;

}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;viewport&quot;&gt;
&lt;div class=&quot;box1&quot;&gt;&lt;img src=&quot;newspaper.jpg&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>As you can seen from above, we have define an animation called &#8220;<strong>spinning</strong>&#8221; with 1 second duration, easing function, no delay, no reverse direction and it won&#8217;t repeat. Now, although we already have defined all these animation properties, our animation cannot work yet. We have to apply it using the <strong>keyframe </strong>rule.</p>
<h3>Keyframe Rule</h3>
<p>With keyframe rule, we can create animation based on the animation properties that we have just defined. The syntax of keyframe is:</p>
<pre class="brush: css; title: ; notranslate">
@keyframes yourAnimationName {keyframes-selector {css-styles;}}
</pre>
<ul>
<li>yourAnimationName &#8211; The name of the animation that defined in the animation property.</li>
<li>keyframes-selector &#8211; Percentage of the animtion duration. Such as 0%, 25%, 50%, 75%, 100%.</li>
<li>css-styles &#8211; The styles properties.</li>
</ul>
<p>Ok, let&#8217;s apply the animation on our newspaper object:</p>
<pre class="brush: css; title: ; notranslate">
&lt;style&gt;
@keyframes spinning
{
0%   {width:10px; height: 7px; transform:rotate(0deg);}
100% {width:468px; height: 330px; transform:rotate(1440deg);}
}
&lt;/style&gt;
</pre>
<p>At 0% of animation duration, we want the newspaper stay far from us, so we have set its width to 10px, height to 7px and no rotation; When the animation is complete at 100%, then we want the newspaper to stay close to us, so we make it more bigger size and with 1440 degrees of rotation. (Note: we want the newspaper has 4 times of 360 degrees of rotation)</p>
<p>Save your document and view it in supported browser, such as Firefox, Chrome and Safari!</p>
<h3>Final Code</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;

&lt;style&gt;

.viewport {
	width: 468px;
	height: 330px;
	margin: 0 auto;
}

.box1 img {
width:468px;
height:330px;
background:rgba(255,0,0,0.5);

animation-name: spinning;
-moz-animation-name:spinning;
-webkit-animation-name:spinning;

animation-duration: 1s;
-moz-animation-duration: 1s;
-webkit-animation-duration: 1s;

animation-timing-function: ease;
-moz-animation-timing-function: ease;
-webkit-animation-timing-function: ease;

animation-delay: 0;
-moz-animation-delay: 0;
-webkit-animation-delay: 0;

animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
-webkit-animation-iteration-count: 1;

animation-direction: normal;
-moz-animation-direction: normal;
-webkit-animation-direction: normal;

}

@keyframes spinning
{
0%   {width:10px; height: 7px; transform:rotate(0deg);}
100% {width:468px; height: 330px; transform:rotate(1440deg);}
}

@-moz-keyframes spinning /* Firefox */
{
0%   {width:10px; height: 7px; -moz-transform:rotate(0deg);}
100% {width:468px; height: 330px; -moz-transform:rotate(1440deg);}
}

@-webkit-keyframes spinning /* Safari and Chrome */
{
0%   {width:10px; height: 7px; -webkit-transform:rotate(0deg);}
100% {width:468px; height: 330px; -webkit-transform:rotate(1440deg);}
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div class=&quot;viewport&quot;&gt;
&lt;div class=&quot;box1&quot;&gt;&lt;img src=&quot;newspaper.jpg&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><a class="demo_btn" target="_blank" href="http://www.onlywebpro.com/demo/css/keyframe.html">View Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2012/04/07/create-stunning-animation-using-css3-animation-keyframe/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS3: Spinner Animation</title>
		<link>http://www.onlywebpro.com/2011/08/26/css3-spinner-animation/</link>
		<comments>http://www.onlywebpro.com/2011/08/26/css3-spinner-animation/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 01:19:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>

		<guid isPermaLink="false">http://www.onlywebpro.com/?p=1610</guid>
		<description><![CDATA[In this tutorial, we are going to create an animated spinner fully with CSS3.]]></description>
				<content:encoded><![CDATA[<div class="tutorial_details">
<h3>Tutorial Details</h3>
<ul>
<li>Difficulty: Beginner</li>
<li>Technology: CSS3</li>
<li>Supported Browser: Chrome 5+, Safari 4+, iOS Safari 2.0</li>
</ul>
</div>
<p>In this tutorial, we are going to create an animated spinner fully with CSS3. Yeah, no need to include JavaScript at all, what we need is just CSS3 already enough! Ok, let&#8217;s start our tutorial. First of all prepare a PNG image with transparent background, you can draw yourself or use the following image and save it as &#8220;<strong>spinner.png</strong>&#8220;:</p>
<p><img src="http://www.onlywebpro.com/wp-content/uploads/2011/09/spinner.png" alt="Spinner" title="Spinner" width="128" height="128" class="alignnone size-full wp-image-1618" /></p>
<h3>HTML Structure</h3>
<p>Well, the HTML structure of the spinner is very simple and easy! What you need to do is just to write a &lt;div&gt; tag and assign an id called &#8220;<strong>spinner</strong>&#8221; to it as shown below:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;CSS3: Spinner Animation | onlyWebPro.com&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;spinner&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>That&#8217;s all for the HTML structure. Let&#8217;s move on to the CSS section.</p>
<h3>CSS</h3>
<p>Let&#8217;s define the style of our spinner with the following css:</p>
<pre class="brush: css; title: ; notranslate">
&lt;style&gt;
#spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	height: 128px;
	width: 128px;
	
	-webkit-mask-image: url(spinner.png);
	background-color: #000;
	-webkit-animation-name: spinnerRotate;
	-webkit-animation-duration: 2s;
	-webkit-animation-iteration-count: infinite;
	-webkit-animation-timing-function: linear;
}
&lt;/style&gt;
</pre>
<p>As you can see above, we have define several properties that with prefix &#8220;<strong>-webkit</strong>&#8220;.</p>
<ul>
<li><strong>-webkit-mask-image:</strong> Link the PNG image we created earlier to &#8220;#spinner&#8221;.</li>
<li><strong>-webkit-animation-name:</strong> The name of the animation. The name is used to select the -webkit-keyframe at-rule that provides the keyframes and property values for the animation.</li>
<li><strong>-webkit-animation-duration:</strong> The duration of the animation. In this case, we set it for 2 seconds.</li>
<li><strong>-webkit-animation-iteration-count:</strong> Specifies the number of times an animation iterates. We set &#8220;infinite&#8221; for this case.</li>
<li><strong>-webkit-animation-timing-function:</strong> Defines animation progresses between key frames. Values available are linear, ease-in, ease-out and ease-in-out.</li>
</ul>
<p>Cool, you have link the spinner PNG image to the div with id &#8220;<strong>#spinner</strong>&#8220;, but now we don&#8217;t see any animation on our page yet, let&#8217;s define the &#8220;<strong>spinnerRotate</strong>&#8221; that we have declares  in &#8220;-webkit-animation-name&#8221;:</p>
<pre class="brush: css; title: ; notranslate">
@-webkit-keyframes spinnerRotate {
	from {
		-webkit-transform:rotate(0deg);
	}
	to {
		-webkit-transform:rotate(360deg);
	}
}
</pre>
<p>As you can see from above, our spinner will start rotate at 0 degrees, and end at 360 degrees, over a time span of 2 seconds and the animation will keep repeating until user close the page.</p>
<h3>Final Code</h3>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;CSS3: Spinner Animation | onlyWebPro.com&lt;/title&gt;
&lt;style&gt;
#spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	height: 128px;
	width: 128px;
	
	-webkit-mask-image: url(spinner.png);
	background-color: #000;
	-webkit-animation-name: spinnerRotate;
	-webkit-animation-duration: 2s;
	-webkit-animation-iteration-count: infinite;
	-webkit-animation-timing-function: linear;
}

@-webkit-keyframes spinnerRotate {
	from {
		-webkit-transform:rotate(0deg);
	}
	to {
		-webkit-transform:rotate(360deg);
	}
}

&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id=&quot;spinner&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>That&#8217;s all, save your document and preview it on webkit browser (Safari 4.0, iOS Safari 2.0 or Chrome), you should see an animated spinner!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onlywebpro.com/2011/08/26/css3-spinner-animation/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
