<?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>hallofhavoc.com</title>
	<atom:link href="http://hallofhavoc.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hallofhavoc.com</link>
	<description>A web design and inspiration blog dedicated to helping web designers and developers</description>
	<lastBuildDate>Tue, 11 Jun 2013 23:01:08 +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>
<meta name="generator" content="deStyle 0.9.3" />
		<item>
		<title>How To Create Your Own Responsive Framework Using Sass – Part 1</title>
		<link>http://hallofhavoc.com/2013/06/how-to-create-your-own-responsive-framework-using-sass-part-1/</link>
		<comments>http://hallofhavoc.com/2013/06/how-to-create-your-own-responsive-framework-using-sass-part-1/#comments</comments>
		<pubDate>Mon, 10 Jun 2013 21:46:34 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[mixins]]></category>
		<category><![CDATA[responsive]]></category>
		<category><![CDATA[sass]]></category>
		<category><![CDATA[scss]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=1107</guid>
		<description><![CDATA[What are Responsive Frameworks? Responsive frameworks are used to help develop and design websites quickly using CSS selectors and classes and allow us to easily create responsive websites with ease. By developing our own responsive framework, we can easily understand how we can use our selectors and classes to quickly build responsive websites. In this [...]]]></description>
				<content:encoded><![CDATA[<h1>What are Responsive Frameworks?</h1>
<p>Responsive frameworks are used to help develop and design websites quickly using CSS selectors and classes and allow us to easily create responsive websites with ease.<span id="more-1107"></span> By developing our own responsive framework, we can easily understand how we can use our selectors and classes to quickly build responsive websites. </p>
<p>In this tutorial, I will be going over how to develop our own responsive framework using the <a href="http://sass-lang.com/">Sass language</a>. If you are not familiar with Sass, you can read my previous article called <a href="http://hallofhavoc.com/2013/05/using-extensible-css-languages-sass-or-less/">Using Extensible CSS Preprocessor Language: Sass or LESS</a> for more information.</p>
<p>In any case, let&#8217;s begin the tutorial. </p>
<h2>Start with Variables</h2>
<p><img src="http://hallofhavoc.com/wp-content/uploads/2013/06/sass-variables.jpg" alt="Sass Variables" width="500" height="180" class="alignnone size-full wp-image-1169" /><br />
Let&#8217;s first start by creating variables for us to use in our responsive framework. Let&#8217;s create a <strong>_vars.scss</strong> file (the underscore is used to determine that we will use it as an import file&#8230;more on that later) and include the following CSS Preprocessor code in there. We&#8217;ll also include default values for some of our styling.</p>
<p>[CSS]<br />
//spacing<br />
$contentWidth: 1000px; //max width of our main content<br />
$gridColumns: 12; // # of columns for our grid. Change as needed<br />
$gutterWidth: 1%; // margin width of gutters between columns. Change as needed.Make sure to use percentages<br />
$auto: 0 auto;</p>
<p>// Colors (feel free to change these values)<br />
$green: #53c73f;<br />
$orange: #ffa126;<br />
$red: #d63838;<br />
$blue: #4286B3;<br />
$yellow: #f9f761;<br />
$gray: #888888;<br />
$white: #ffffff;<br />
$black: #000000;</p>
<p>//elements<br />
$linkColor: $blue;<br />
$linkHover: lighten($blue, 20%);<br />
$font-family: &#8216;Helvetica Neue&#8217;, &#8216;Helvetica&#8217;, Arial, sans-serif;<br />
[/CSS]</p>
<h2>Time for some Mixins</h2>
<p><img src="http://hallofhavoc.com/wp-content/uploads/2013/06/sass-mixins1.jpg" alt="Sass Mixins" width="500" height="180" class="alignnone size-full wp-image-1170" /><br />
Now that we have that out of the way, let&#8217;s create a separate file for our mixins and name it <strong>_mixins.scss</strong>. We&#8217;ll include the following mixins to our framework. These mixins can also be found in my previous article <a href="http://hallofhavoc.com/2013/06/free-and-useful-sass-mixins-you-can-use-for-your-next-project/">Free and Useful Sass Mixins You Can Use for Your Next Project</a>. The article also talks about the purpose of mixins and how they are used.</p>
<p>The great thing about mixins is that they will not be rendered unless you call them. Anyways, here are the mixins we&#8217;ll be using:</p>
<p>[CSS]<br />
@mixin letterpress($opacity: 0.5){<br />
    text-shadow:0 1px 1px rgba(255,255,255,$opacity);<br />
}<br />
@mixin text-shadow($opacity:0.5){<br />
    text-shadow:0 1px 1px rgba(0,0,0,$opacity);<br />
}<br />
@mixin border-radius ($borderRadius){<br />
    -webkit-border-radius: $borderRadius;<br />
    -moz-border-radius: $borderRadius;<br />
    border-radius: $borderRadius;<br />
}<br />
@mixin box-shadow ($boxShadow&#8230;){<br />
    -moz-box-shadow: $boxShadow;<br />
    -webkit-box-shadow: $boxShadow;<br />
    -ms-box-shadow: $boxShadow;<br />
    -o-box-shadow: $boxShadow;<br />
    box-shadow: $boxShadow;<br />
}</p>
<p>//border radius directions<br />
@mixin border-top-radius ($borderRadius){<br />
    -webkit-border-top-left-radius: $borderRadius;<br />
    -webkit-border-top-right-radius: $borderRadius;<br />
    -moz-border-radius-topleft: $borderRadius;<br />
    -moz-border-radius-topright: $borderRadius;<br />
    border-radius: $borderRadius $borderRadius 0 0;<br />
}<br />
@mixin border-bottom-radius ($borderRadius){<br />
    -webkit-border-bottom-left-radius: $borderRadius;<br />
    -webkit-border-bottom-right-radius: $borderRadius;<br />
    -moz-border-radius-bottomleft: $borderRadius;<br />
    -moz-border-radius-bottomright: $borderRadius;<br />
    border-radius: 0 0 $borderRadius $borderRadius;<br />
}<br />
@mixin border-left-radius ($borderRadius){<br />
    -webkit-border-top-left-radius: $borderRadius;<br />
    -webkit-border-bottom-left-radius: $borderRadius;<br />
    -moz-border-radius-topleft: $borderRadius;<br />
    -moz-border-radius-bottomleft: $borderRadius;<br />
    border-radius: $borderRadius 0 0 $borderRadius;<br />
}<br />
@mixin border-right-radius ($borderRadius){<br />
    -webkit-border-top-right-radius: $borderRadius;<br />
    -webkit-border-bottom-right-radius: $borderRadius;<br />
    -moz-border-radius-topright: $borderRadius;<br />
    -moz-border-radius-bottomright: $borderRadius;<br />
    border-radius: 0 $borderRadius $borderRadius 0;<br />
}</p>
<p>//for use of custom transitions<br />
@mixin transition($transition) {<br />
     -webkit-transition: $transition;<br />
        -moz-transition: $transition;<br />
         -ms-transition: $transition;<br />
          -o-transition: $transition;<br />
             transition: $transition;<br />
}<br />
@mixin box-shadow-transition ($duration){<br />
	-webkit-transition: box-shadow #{$duration}s ease;<br />
	-moz-transition: box-shadow #{$duration}s ease;<br />
	-o-transition: box-shadow #{$duration}s ease;<br />
	transition: box-shadow #{$duration}s ease;<br />
}</p>
<p>//transformations<br />
@mixin box-rotate ($deg){<br />
  -webkit-transform: rotate(#{$deg}deg);<br />
     -moz-transform: rotate(#{$deg}deg);<br />
      -ms-transform: rotate(#{$deg}deg);<br />
       -o-transform: rotate(#{$deg}deg);<br />
          transform: rotate(#{$deg}deg);<br />
}<br />
@mixin scale($ratio) {<br />
  -webkit-transform: scale($ratio);<br />
     -moz-transform: scale($ratio);<br />
      -ms-transform: scale($ratio);<br />
       -o-transform: scale($ratio);<br />
          transform: scale($ratio);<br />
}<br />
@mixin translate($x, $y) {<br />
  -webkit-transform: translate($x, $y);<br />
     -moz-transform: translate($x, $y);<br />
      -ms-transform: translate($x, $y);<br />
       -o-transform: translate($x, $y);<br />
          transform: translate($x, $y);<br />
}<br />
@mixin skew($x, $y) {<br />
  -webkit-transform: skew($x, $y);<br />
     -moz-transform: skew($x, $y);<br />
      -ms-transform: skew($x, $y);<br />
       -o-transform: skew($x, $y);<br />
          transform: skew($x, $y);<br />
}<br />
@mixin translate3d($x, $y, $z) {<br />
  -webkit-transform: translate3d($x, $y, $z);<br />
     -moz-transform: translate3d($x, $y, $z);<br />
       -o-transform: translate3d($x, $y, $z);<br />
          transform: translate3d($x, $y, $z);<br />
}</p>
<p>//Add opacity to elements<br />
@mixin opacity($opacity){<br />
    -ms-filter: &#8220;progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$opacity}*10)&#8221;;<br />
    filter: alpha(opacity=#{$opacity}*100);<br />
    -moz-opacity: $opacity;<br />
    -khtml-opacity: $opacity;<br />
    opacity: $opacity;<br />
}</p>
<p>// Add an alphatransparency value to any background or border color<br />
@mixin translucent-background($color: #fff, $alpha: 0.5) {<br />
    background: $color; //fallback<br />
    background: hsla(hue($color), saturation($color), lightness($color), $alpha);<br />
}<br />
@mixin translucent-border($size: 1px, $style: solid, $color: #fff, $alpha: 0.5) {<br />
    border: $size $style hsla(hue($color), saturation($color), lightness($color), $alpha);<br />
    background-clip: padding-box;<br />
}</p>
<p>//gradients<br />
@mixin gradient($startColor, $endColor, $noGradient: mix($startColor, $endColor,50%), $type: &#8216;vertical&#8217;, $degOrImagePath: &#8221;){<br />
  @if ($type == &#8216;vertical&#8217;){<br />
    background: $noGradient;<br />
    @each $i in &#8221; {<br />
      background: #{$i}linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%);<br />
    }<br />
  }</p>
<p>  @if ($type == &#8216;horizontal&#8217;){<br />
    background: $noGradient;<br />
    @each $i in -webkit-, -moz-, -ms-, -o- {<br />
      background: #{$i}linear-gradient(left, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%);<br />
    }<br />
    background: linear-gradient(to right, $startColor, $endColor) repeat-x $endColor;<br />
  }</p>
<p>  @if ($type == &#8216;radial&#8217;){<br />
    background: $noGradient;<br />
    @each $i in -webkit-, -moz-, -ms-, -o-, &#8221;{<br />
      background: #{$i}radial-gradient(circle, $startColor, $endColor) no-repeat mix($startColor, $endColor, 60%);<br />
    }<br />
  }</p>
<p>  @if ($type == &#8216;directional&#8217;){<br />
    background: $noGradient;<br />
    @each $i in -webkit-, -moz-, -ms-, -o-, &#8221; {<br />
      background: #{$i}linear-gradient(#{$degOrImagePath}deg, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%);<br />
    }<br />
  }</p>
<p>  @if ($type == &#8216;image&#8217;){<br />
    background: url(&#8216;#{$degOrImagePath}&#8217;) no-repeat scroll $noGradient;<br />
    @each $i in -webkit-, -moz-, -ms-, -o-, &#8221; {<br />
      background: url(&#8216;#{$degOrImagePath}&#8217;) no-repeat scroll, #{$i}linear-gradient(center top, $startColor, $endColor);<br />
    }<br />
  }</p>
<p>}</p>
<p>@mixin gradient-vertical-three-colors($startColor: #00b3ee, $midColor: #7a43b6, $colorStop: 50%, $endColor: #c3325f, $noGradient: #444){<br />
  background: $noGradient;<br />
  @each $i in -webkit-, -moz-, -ms-, -o-, &#8221; {<br />
    background: #{$i}linear-gradient($startColor, $midColor $colorStop, $endColor) no-repeat mix($midColor, $endColor, 80%);<br />
  }<br />
}<br />
@mixin gradient-vertical-button($highlightColor: #fbeda1, $topColor: #FFBB02, $bottomColor: #EB6900, $shadowColor: #b07504){<br />
  background: $bottomColor;<br />
  @each $i in -webkit-, -moz-, -ms-, -o-, &#8221; {<br />
    background: #{$i}linear-gradient(top,  $highlightColor 0%,$topColor 4%,$bottomColor 95%,$shadowColor 100%);<br />
  }<br />
}</p>
<p>// triangles ($direction can be: up, down, left, right, up-right, up-left, down-righ or down-left)<br />
@mixin triangle ($size, $color, $direction) {<br />
    height: 0;<br />
    width: 0;</p>
<p>    @if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) {<br />
        border-color: transparent;<br />
        border-style: solid;<br />
        border-width: $size / 2;</p>
<p>        @if $direction == up {<br />
            border-bottom-color: $color;<br />
        } @else if $direction == right {<br />
            border-left-color: $color;<br />
        } @else if $direction == down {<br />
            border-top-color: $color;<br />
        } @else if $direction == left {<br />
            border-right-color: $color;<br />
        }<br />
    }</p>
<p>    @else if ($direction == up-right) or ($direction == up-left) {<br />
        border-top: $size solid $color;</p>
<p>        @if $direction == up-right {<br />
            border-left: $size solid transparent;<br />
        } @else if $direction == up-left {<br />
            border-right: $size solid transparent;<br />
        }<br />
    }</p>
<p>    @else if ($direction == down-right) or ($direction == down-left) {<br />
        border-bottom: $size solid $color;</p>
<p>        @if $direction == down-right {<br />
            border-left: $size solid transparent;<br />
        } @else if $direction == down-left {<br />
            border-right: $size solid transparent;<br />
        }<br />
    }<br />
}</p>
<p>//hide text for use with background images<br />
@mixin hide-text{<br />
    overflow:hidden;<br />
    text-indent:-9999px;<br />
    display:block;<br />
}</p>
<p>//for custom @font-face<br />
@mixin family($family: &#8221;, $url: &#8216;/fonts/&#8217;, $weight: normal, $style: normal) {<br />
    @font-face {<br />
        font-family: $family;<br />
        src: url(&#8216;#{$url}.eot&#8217;);<br />
        src: url(&#8216;#{$url}.eot?#iefix&#8217;) format(&#8216;embedded-opentype&#8217;),<br />
             url(&#8216;#{$url}.woff&#8217;) format(&#8216;woff&#8217;),<br />
             url(&#8216;#{$url}.ttf&#8217;) format(&#8216;truetype&#8217;),<br />
             url(&#8216;#{$url}.svg#svg&#8217;) format(&#8216;svg&#8217;);<br />
        font-weight: $weight;<br />
        font-style: $style;<br />
    }<br />
}</p>
<p>// Clearfix for clearing floats like a boss (from h5bp.com/q)<br />
@mixin clearfix() {<br />
    zoom: 1;<br />
    &#038;:before,<br />
    &#038;:after {<br />
        display: table;<br />
        content: &#8220;&#8221;;<br />
        zoom: 1;<br />
    }<br />
    &#038;:after {<br />
        clear: both;<br />
    }<br />
}</p>
<p>// browser specific&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
@mixin ie7-inline-block() {<br />
    vertical-align: baseline; // for all other browsers<br />
    *vertical-align: auto; // set for consistency in IE7<br />
    *display: inline; // IE7 inline-block hack<br />
    *zoom: 1; //enables hasLayout<br />
}</p>
<p>// IE7 likes to collapse whitespace on either side of the inline-block elements.<br />
// Ems because we&#8217;re attempting to match the width of a space character. Left<br />
// version is for form buttons, which typically come after other elements, and<br />
// right version is for icons, which come before. Applying both is ok, but it will<br />
// mean that space between those elements will be .6em (~2 space characters) in IE7,<br />
// instead of the 1 space in other browsers.<br />
@mixin ie7-restore-left-whitespace() {<br />
    *margin-left: .3em;</p>
<p>    &#038;:first-child {<br />
        *margin-left: 0;<br />
    }<br />
}</p>
<p>@mixin ie7-restore-right-whitespace() {<br />
    *margin-right: .3em;   </p>
<p>    &#038;:last-child {<br />
        *margin-left: 0;<br />
    }<br />
}<br />
[/CSS]</p>
<h2>The Framework Structure</h2>
<p><img src="http://hallofhavoc.com/wp-content/uploads/2013/06/sass-grid.jpg" alt="Sass Grid Structure" width="500" height="180" class="alignnone size-full wp-image-1171" /><br />
Now that we have our variables and mixins set up, let&#8217;s get into the actual nitty gritty structure of our framework. Let&#8217;s start by creating another file and naming it <strong>_default.scss</strong>. We&#8217;ll include all the structure styles and default styles for our framework within this file. I&#8217;ll also be explaining the three different portions of this file in detail below:</p>
<h3>Imports and CSS Resets</h3>
<p>Let&#8217;s start off by including our variables and mixins into our <strong>_default.scss</strong> file as well as some simple CSS resets.<br />
[CSS]<br />
// Import our _vars.scss and _mixins.scss files.<br />
// Notice that I don&#8217;t include the underscore(_) or file extension(.scss) when importing our _vars.scss and _mixins.scss files<br />
@import &#8220;vars&#8221;, &#8220;mixins&#8221;;</p>
<p>//&#8212;&#8211; CSS RESETS<br />
* {<br />
    margin:0;<br />
    padding:0;<br />
    -moz-box-sizing: border-box; /* Firefox, other Gecko */<br />
    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */<br />
    box-sizing: border-box; /* Opera/IE 8+ */<br />
}<br />
img {<br />
    border:0 none;<br />
}<br />
html {<br />
    width:100%;<br />
    height:100%;<br />
    min-height:100%;<br />
}<br />
body {<br />
    width: 100%;<br />
    color: #333;<br />
    position:relative;<br />
    text-align: left;<br />
    font-size: 1em;<br />
    line-height:1.4em;<br />
    font-family: $font-family;<br />
    background: #fff;<br />
}<br />
a {<br />
    color:$blue;<br />
    text-decoration: none;<br />
    &#038;:hover {<br />
        color: lighten($blue, 20%);<br />
    }<br />
}<br />
.hidden {display: none;}</p>
<p>//&#8212;&#8211; GLOBAL FONTS</p>
<p>h1 {font-size: 2.4em;}<br />
h2 {font-size: 1.4em;}<br />
h3 {font-size: 1.2em;}<br />
h4 {font-size: 1em;}<br />
h5 {font-size: .8em;}<br />
h6 {font-size: .6em;}<br />
label {font-size: .8em;}<br />
p {font-size: 1em;}<br />
[/CSS]</p>
<p>As you may have noticed, we imported our <strong>_vars.scss</strong> and <strong>_mixins.scss</strong> files using  <strong>@import</strong> function.</p>
<p>We are also using the new box model structure using the <strong><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing">box-sizing</a></strong> properties for all our elements. (You can learn more about box-sizing from Chris Coyier&#8217;s <a href="http://css-tricks.com/box-sizing/">box-sizing</a> article ) This ensures that we don&#8217;t get weird padding and/or width issues for our responsive box-model elements.</p>
<h3>Responsive Grid Structure</h3>
<p>Next we&#8217;ll include our actual grid classes which is the main bulk of our responsive grid system. We&#8217;ll also include some breakpoints (media queries) that we&#8217;ll use for our desktop and mobile views.</p>
<p>[CSS]<br />
//&#8212;&#8211; GRID STRUCTURE<br />
/* Notice how we&#8217;re using the silent classes with the &#8216;%&#8217; symbol. Silent classes were introduced in Sass version 3.2<br />
*  Silent classes are not rendered in your CSS file unless they are called upon, thus slimming down your CSS file size<br />
*  We&#8217;ll be using these silent classes when we start designing our actual webpages<br />
*/<br />
.grid {<br />
	overflow: hidden;<br />
	width:$contentWidth;<br />
	margin:$auto;<br />
}<br />
%gridBase {<br />
    float:left;<br />
    margin: 0 $gutterWidth;<br />
}</p>
<p>// grid making magic<br />
@for $i from 1 through $gridColumns {<br />
	.g#{$i} {<br />
		@extend %gridBase;<br />
		width: ((100%/$gridColumns)*$i)-$gutterWidth*2;<br />
	}<br />
}</p>
<p>//&#8212;&#8211; BREAKPOINTS<br />
@media only screen and (max-width: $contentWidth)<br />
{<br />
	.grid {<br />
		width:100%;<br />
		margin: $auto;<br />
	}<br />
}</p>
<p>@media only screen and (min-width: 0px) and (max-width: 480px)<br />
{<br />
	.grid {width:100%;}<br />
	@for $i from 1 through $gridColumns {<br />
		.g#{$i} {<br />
			width: 100%;<br />
			margin: $auto;<br />
		}<br />
	}<br />
}</p>
<p>[/CSS]</p>
<p>Let&#8217;s break this down to get a better understanding of how we&#8217;ll use this grid based system on our webpages. First let&#8217;s talk about the <strong>.grid</strong> class:<br />
[CSS]<br />
.grid {<br />
	overflow: hidden;<br />
	width:$contentWidth;<br />
	margin:$auto;<br />
}<br />
[/CSS]<br />
You&#8217;ll notice that we are using <strong>overflow:hidden;</strong>. This is to prevent the issue of the container not covering the entire grids when working with floats (You&#8217;ll notice this if you apply a background color or something similar). Since our grid system will mostly be using floats to simulate columns, we need our parent container to clear and wrap around the entire grid system (using <strong>overflow:hidden;</strong> allows that to happen without adding unnecessary clear divs in our HTML markup). </p>
<p>You&#8217;ll also notice that we use the <strong>$contentWidth</strong> variable which is called from our <strong>_vars.scss</strong> file which we imported earlier on. This is the max-width we&#8217;ll be using as our base viewable area for desktops. And of course adding our <strong>margin: $auto;</strong> which also comes from our <strong>_vars.scss</strong> file.</p>
<p>Next, let&#8217;s break down the actual grid system:<br />
[CSS]<br />
%gridBase {<br />
    float:left;<br />
    margin: 0 $gutterWidth;<br />
}</p>
<p>// grid making magic<br />
@for $i from 1 through $gridColumns {<br />
	.g#{$i} {<br />
		@extend %gridBase;<br />
		width: ((100%/$gridColumns)*$i)-$gutterWidth*2;<br />
	}<br />
}<br />
[/CSS]<br />
You&#8217;ll notice that we&#8217;re using the silent class called <strong>%gridBase</strong>. The reason for this is so that it doesn&#8217;t have to be rendered in the final CSS output(thus saving a few lines of code if you don&#8217;t need to call it). Instead, we will use this to extend our grid system.</p>
<p>As you can see, we&#8217;re also using a <strong>@for from through</strong> <a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#id11">Control Directive</a> to create our grid system. </p>
<p>What this does is reiterate through the number of <strong>$gridColumns</strong> we have set in our <strong>_vars.scss</strong> file (in this case, the default we set was 12 columns). Then it creates 12 grid-based classes that we&#8217;ll use in our HTML markup. </p>
<p>This is the actual CSS output of our <strong>@for from through</strong> function:<br />
[CSS]<br />
.g1, .g2, .g3, .g4, .g5, .g6, .g7, .g8, .g9, .g10, .g11, .g12 {<br />
  float: left;<br />
  margin: 0 1%;<br />
}<br />
.g1 {width: 6.33333%;}<br />
.g2 {width: 14.66667%;}<br />
.g3 {width: 23%;}<br />
.g4 {width: 31.33333%;}<br />
.g5 {width: 39.66667%;}<br />
.g6 {width: 48%;}<br />
.g7 {width: 56.33333%;}<br />
.g8 {width: 64.66667%;}<br />
.g9 {width: 73%;}<br />
.g10 {width: 81.33333%;}<br />
.g11 {width: 89.66667%;}<br />
.g12 {width: 98%;}<br />
[/CSS]<br />
Notice how that the <strong>@for from through</strong> function created our grid system for us. You&#8217;ll also notice that the <strong>@extend %gridBase;</strong> applies the float left and margins to all our grid column classes. Furthermore, the <strong>@for from through</strong> function has also applied the appropriate widths of our columns to compensate for the gutter width that we had applied in our variables file. Play around with the <strong>$gridColumns</strong> and <strong>$gutterWidth</strong>values in the <strong>_vars.scss</strong> files to see how the grid system changes.</p>
<p>Lastly, let&#8217;s talk about our media query breakpoints which will help us display different grid-based system depending on device width:<br />
[CSS]<br />
//&#8212;&#8211; BREAKPOINTS<br />
@media only screen and (max-width: $contentWidth)<br />
{<br />
    .grid {<br />
        width:100%;<br />
        margin: $auto;<br />
    }<br />
}</p>
<p>@media only screen and (min-width: 0px) and (max-width: 480px)<br />
{<br />
    .grid {width:100%;}<br />
    @for $i from 1 through $gridColumns {<br />
        .g#{$i} {<br />
            width: 100%;<br />
            margin: $auto;<br />
        }<br />
    }<br />
}<br />
[/CSS]</p>
<p>You&#8217;ll notice that in the first breakpoint, once it reaches the max-width of our container, we make our main <strong>.grid</strong> class to 100% the width of our browser window. </p>
<p>The second media query will expand all our grid sizes to 100% width when it reaches 480px device width or lower.</p>
<p>This will become more apparent when we apply it to our webpage HTML structure. Primarily,we&#8217;ll be applying our grid like so:</p>
<p>[HTML]</p>
<div class="content grid">
<div class="g1">G1</div>
<div class="g2">G2</div>
<div class="g3">G3</div>
<div class="g4">G4</div>
<div class="g5">G5</div>
<div class="g6">G6</div>
<div class="g7">G7</div>
<div class="g8">G8</div>
<div class="g9">G9</div>
<div class="g10">G10</div>
<div class="g11">G11</div>
<div class="g12">G12</div>
</div>
<p>[/HTML]</p>
<h3>Extra Styling Elements (optional)</h3>
<p>These are extra styling classes for input forms and buttons. Feel free to include this to your framework if needed.</p>
<p>[CSS]<br />
//&#8212;&#8211; EXTRA STYLES<br />
// input<br />
input[type="text"],<br />
input[type="number"],<br />
input[type="email"], textarea {<br />
    background: none repeat scroll 0 0 #fff;<br />
    border:1px solid #777;<br />
    @include border-radius(4px);<br />
    @include box-shadow(0 0 3px rgba(0, 0, 0, 0.25) inset, 0 0 3px rgba(0, 0, 0, 0.3));<br />
    color: $gray;<br />
    display: block;<br />
    float: left;<br />
    font-size: .8em;<br />
    height: auto;<br />
    margin: 0 0 6px 0;<br />
    padding: 0.2em;<br />
    line-height: 30px;<br />
    height:30px;<br />
    width: 100%;<br />
}<br />
textarea:focus,<br />
input[type="text"]:focus,<br />
input[type="number"]:focus,<br />
input[type="email"]:focus {<br />
    @include box-shadow(0 0 3px rgba(0, 0, 0, 0.5) inset,0 0 3px rgba(66, 134, 179, 0.8));<br />
    border:1px solid $gray;<br />
    color: #333;<br />
    text-shadow:0 1px 0 rgba(255,255,255,0.6);<br />
}<br />
input:focus::-webkit-input-placeholder,<br />
input:focus::-moz-placeholder {<br />
    color: $gray;<br />
}</p>
<p>//button classes<br />
%btn {<br />
    width:auto;<br />
    height:auto;<br />
    color: #fff;<br />
    clear: both;<br />
    float: none;<br />
    font-weight: bold;<br />
    font-size: 1.3em;<br />
    padding: 6px 8px;<br />
    border: 0 none;<br />
    text-shadow:0 0 3px rgba(0,0,0,0.3);<br />
    @include box-shadow(0 1px 3px rgba(0,0,0,0.25));<br />
    @include border-radius(4px);<br />
    margin: $auto;<br />
    text-align: center;<br />
    display:block;<br />
    cursor:pointer;<br />
    position:static;<br />
}<br />
%blue-btn {<br />
    @extend %btn;<br />
    @include gradient-vertical-button(#87ccf9, #5aade4, #4286b3, #3777a1);<br />
    &#038;:hover {<br />
        @include gradient(#4286b3, #519fd2,lighten(#4286b3,20%));<br />
    }<br />
}<br />
%red-btn {<br />
    @extend %btn;<br />
    @include gradient-vertical-button(#f98787, #e45a5a, #b93b3b, #a13737);<br />
    &#038;:hover {<br />
        @include gradient(#b34242, #d25151,lighten(#b34242,20%));<br />
    }<br />
}<br />
%orange-btn {<br />
    @extend %btn;<br />
    @include gradient-vertical-button(#f3cd1b, #f2ac04, #e47203, #c65f04);<br />
    &#038;:hover {<br />
        @include gradient(#e57403, #ef9d05,lighten(#e57403,20%));<br />
    }<br />
}</p>
<p>[/CSS]</p>
<h2>Conclusion</h2>
<p><a href="http://hallofhavoc.com/wp-content/uploads/2013/06/Sass-framework.zip" rel="nofollow">Download Source Files</a></p>
<p>This concludes <strong>Part 1</strong> of the <strong>How To Create Your Own Responsive Framework Using Sass</strong> tutorial. I hope that this tutorial has helped you understand a little about how to create your own responsive frameworks. </p>
<p>The basic structure and code are just a small preview of how powerful and useful Sass (and other CSS preprocessor languages) is. I hope that this tutorial made you understand the basics of using Sass and all its possibilities.</p>
<p>In <strong>Part 2</strong> of this tutorial series, I&#8217;ll walk you through the actual usage of how to implement our responsive framework. If you found this tutorial useful, please let me know in the comments below. <strong>Also, don&#8217;t forget to spread the word by Tweeting and Liking this tutorial</strong>. You can also sign up to the monthly newsletter to get updates, articles, and free tutorials such as this.</p>
<p><strong>Other Articles you might like:</strong></p>
<ul>
<li><a href="http://hallofhavoc.com/2013/06/free-sass-mixins-for-your-next-project/">Free Sass Mixins For Your Next Project</a></li>
<li><a href="http://hallofhavoc.com/2013/05/using-extensible-css-preprocessor-languages-sass-or-less/">Using Extensible CSS Preprocessor Languages: Sass or LESS</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/06/how-to-create-your-own-responsive-framework-using-sass-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Sass Mixins For Your Next Project</title>
		<link>http://hallofhavoc.com/2013/06/free-sass-mixins-for-your-next-project/</link>
		<comments>http://hallofhavoc.com/2013/06/free-sass-mixins-for-your-next-project/#comments</comments>
		<pubDate>Tue, 04 Jun 2013 19:01:31 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[mixin]]></category>
		<category><![CDATA[mixins]]></category>
		<category><![CDATA[sass]]></category>
		<category><![CDATA[stylesheet]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=1135</guid>
		<description><![CDATA[If you know CSS Preprocessor languages such as Sass, then you definitely know the value of having a few mixins to help you develop and design your web pages faster without having to repeat the same code over and over again. If you don&#8217;t know what Sass is or what CSS Preprocessor Languages are, you [...]]]></description>
				<content:encoded><![CDATA[<p>If you know CSS Preprocessor languages such as <a href="http://www.sass-lang.com">Sass</a>, then you definitely know the value of having a few mixins to help you develop and design your web pages faster without having to repeat the same code over and over again.<span id="more-1135"></span></p>
<p>If you don&#8217;t know what Sass is or what CSS Preprocessor Languages are, you might want to check out my previous article (where I talk a little about mixins as well) to get a better understanding of what they are and how they can benefit you: <a href="http://hallofhavoc.com/2013/05/using-extensible-css-preprocessor-languages-sass-or-less/">Using Extensible CSS Preprocessor Languages: Sass or LESS</a>.</p>
<h2>What are mixins?</h2>
<p>So you&#8217;re probably wondering to yourself what mixins exactly are&#8230;Mixins are little snippets of CSS Preprocessor &#8220;code&#8221; that you can use as part of your project to help you write CSS code much faster without having to repeat yourself over and over again. In short, it&#8217;s lines of CSS that you would normally write, say for example to add a gradient background to a div, by just calling it once instead of having to write a prefix for specific browsers each time. Let&#8217;s take a look at an example of how a mixin can help.</p>
<p>Let&#8217;s say you wanted to have a gradient background for a specific content div. When you&#8217;re writing normal CSS, you would write something like this:<br />
[CSS]<br />
.content {<br />
	background: #cccccc; /* fallback color for older browsers */<br />
	background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#eeeeee), to(#aaaaaa));<br />
	background: -webkit-linear-gradient(top, #aaaaaa, #eeeeee);<br />
	background: -moz-linear-gradient(top, #aaaaaa, #eeeeee);<br />
	background: -ms-linear-gradient(top, #aaaaaa, #eeeeee);<br />
	background: -o-linear-gradient(top, #aaaaaa, #eeeeee);<br />
	background: linear-gradient(top, #aaaaaa, #eeeeee);<br />
}<br />
[/CSS]</p>
<p>As you can see, you would have to write each of those lines separately each time you wanted to create a gradient background for other divs. In Sass (or other CSS Preprocessor languages), you can create a mixin that you can call once wherever you want it to be applied and it will create those lines for you.</p>
<p>Let&#8217;s take the above example and create our own Sass mixin that we can call.</p>
<p>[CSS]<br />
 @mixin gradient-vertical($startColor: #eeeeee, $endColor: #aaaaaa, $noGradient: #cccccc){<br />
 	background: $noGradient; //fallback for older browsers<br />
 	background: -moz-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // FF 3.6+<br />
 	background: -webkit-gradient(linear, 0 0, 0 100%, from($startColor), to($endColor)) repeat-x mix($startColor, $endColor, 60%); // Safari 4+, Chrome 2+<br />
 	background: -webkit-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Safari 5.1+, Chrome 10+<br />
 	background: -o-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Opera 11.10<br />
 	background: linear-gradient(to bottom, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Standard, IE10<br />
}<br />
[/CSS]</p>
<p>As you can see from the code above, we have created a linear gradient mixin that will apply the default values of the hex color values #eeeeee, #aaaaaa, and #cccccc respectively. </p>
<p><strong>Note that I&#8217;m using the mix() function as part of the background properties which mixes the $startcolor and $stopcolor values at 60% weight. </strong></p>
<p>So here is how we will apply that mixin if we use it for our webpage:</p>
<p>[CSS]<br />
.content {<br />
	@include gradient-vertical();<br />
}<br />
article {<br />
	@include gradient-vertical(#9bbe4d, #649419, #80a933);<br />
}<br />
[/CSS]</p>
<p>Notice that in the first example, I called the mixin using <strong>@include [mixin name]()</strong>. You call mixins by using the <strong>@include</strong> statement followed by the mixin name and open/close parenthesis. This will output the default values you have set to that mixin (In this case the defaults are #eeeeee, #aaaaaa, #cccccc).</p>
<p>As you may have also noticed, in the second example, I have replaced the default color values with values that I want to be used instead. I applied a nice green gradient background using those 3 values instead of the default gray gradient.</p>
<p>And Here is the output:</p>
<p>[CSS]<br />
.content {<br />
	background: #cccccc;<br />
	background: -moz-linear-gradient(top, #eeeeee, #aaaaaa) repeat-x #d2d2d2;<br />
	background: -webkit-gradient(linear, 0 0, 0 100%, from(#eeeeee), to(#aaaaaa)) repeat-x #d2d2d2;<br />
	background: -webkit-linear-gradient(top, #eeeeee, #aaaaaa) repeat-x #d2d2d2;<br />
	background: -o-linear-gradient(top, #eeeeee, #aaaaaa) repeat-x #d2d2d2;<br />
	background: linear-gradient(to bottom, #eeeeee, #aaaaaa) repeat-x #d2d2d2;<br />
}</p>
<p>article {<br />
	background: #80a933;<br />
	background: -moz-linear-gradient(top, #9bbe4d, #649419) repeat-x #85ad38;<br />
	background: -webkit-gradient(linear, 0 0, 0 100%, from(#9bbe4d), to(#649419)) repeat-x #85ad38;<br />
	background: -webkit-linear-gradient(top, #9bbe4d, #649419) repeat-x #85ad38;<br />
	background: -o-linear-gradient(top, #9bbe4d, #649419) repeat-x #85ad38;<br />
	background: linear-gradient(to bottom, #9bbe4d, #649419) repeat-x #85ad38;<br />
}<br />
[/CSS]</p>
<p>As you can see, mixins become very useful when you need to include code multiple times without having to retype it over and over again. Plus, the actual mixin itself does not get rendered in the output as it is only used when called upon.</p>
<h2>Free Mixins For Everyone!</h2>
<p>Now that we understand how mixins work, here&#8217;s a few mixins that I use to help me develop and design webpages quickly and efficiently:  </p>
<p>[CSS]<br />
@mixin letterpress($opacity){<br />
    text-shadow:0 1px 1px rgba(255,255,255,$opacity);<br />
}<br />
@mixin blackShadow($opacity){<br />
    text-shadow:0 1px 1px rgba(0,0,0,$opacity);<br />
}<br />
@mixin border-radius($borderRadius){<br />
    -webkit-border-radius: $borderRadius;<br />
    -moz-border-radius: $borderRadius;<br />
    border-radius: $borderRadius;<br />
}<br />
@mixin box-shadow($boxShadow){<br />
    -moz-box-shadow: $boxShadow;<br />
    -webkit-box-shadow: $boxShadow;<br />
    -ms-box-shadow: $boxShadow;<br />
    -o-box-shadow: $boxShadow;<br />
    box-shadow: $boxShadow;<br />
}<br />
@mixin box-shadow-2($boxShadow, $boxShadowInset){<br />
    -moz-box-shadow: $boxShadow, $boxShadowInset;<br />
    -webkit-box-shadow: $boxShadow, $boxShadowInset;<br />
    -ms-box-shadow: $boxShadow, $boxShadowInset;<br />
    -o-box-shadow: $boxShadow, $boxShadowInset;<br />
    box-shadow: $boxShadow, $boxShadowInset;<br />
}</p>
<p>//border radius directions<br />
@mixin border-top-radius($borderRadius){<br />
    -webkit-border-top-left-radius: $borderRadius;<br />
    -webkit-border-top-right-radius: $borderRadius;<br />
    -moz-border-radius-topleft: $borderRadius;<br />
    -moz-border-radius-topright: $borderRadius;<br />
    border-radius: $borderRadius $borderRadius 0 0;<br />
}<br />
@mixin border-bottom-radius($borderRadius){<br />
    -webkit-border-bottom-left-radius: $borderRadius;<br />
    -webkit-border-bottom-right-radius: $borderRadius;<br />
    -moz-border-radius-bottomleft: $borderRadius;<br />
    -moz-border-radius-bottomright: $borderRadius;<br />
    border-radius: 0 0 $borderRadius $borderRadius;<br />
}<br />
@mixin border-left-radius($borderRadius){<br />
    -webkit-border-top-left-radius: $borderRadius;<br />
    -webkit-border-bottom-left-radius: $borderRadius;<br />
    -moz-border-radius-topleft: $borderRadius;<br />
    -moz-border-radius-bottomleft: $borderRadius;<br />
    border-radius: $borderRadius 0 0 $borderRadius;<br />
}<br />
@mixin border-right-radius($borderRadius){<br />
    -webkit-border-top-right-radius: $borderRadius;<br />
    -webkit-border-bottom-right-radius: $borderRadius;<br />
    -moz-border-radius-topright: $borderRadius;<br />
    -moz-border-radius-bottomright: $borderRadius;<br />
    border-radius: 0 $borderRadius $borderRadius 0;<br />
}</p>
<p>//for use of custom transitions<br />
@mixin transition($transition) {<br />
     -webkit-transition: $transition;<br />
        -moz-transition: $transition;<br />
         -ms-transition: $transition;<br />
          -o-transition: $transition;<br />
             transition: $transition;<br />
}<br />
@mixin box-shadow-transition($duration){<br />
	-webkit-transition: box-shadow #{$duration}s ease;<br />
	-moz-transition: box-shadow #{$duration}s ease;<br />
	-o-transition: box-shadow #{$duration}s ease;<br />
	transition: box-shadow #{$duration}s ease;<br />
}</p>
<p>//transformations<br />
@mixin box-rotate($deg){<br />
	-webkit-transform: rotate(#{$deg}deg);<br />
     -moz-transform: rotate(#{$deg}deg);<br />
      -ms-transform: rotate(#{$deg}deg);<br />
       -o-transform: rotate(#{$deg}deg);<br />
          transform: rotate(#{$deg}deg);<br />
}<br />
@mixin scale($ratio) {<br />
  -webkit-transform: scale($ratio);<br />
     -moz-transform: scale($ratio);<br />
      -ms-transform: scale($ratio);<br />
       -o-transform: scale($ratio);<br />
          transform: scale($ratio);<br />
}<br />
@mixin translate($x, $y) {<br />
  -webkit-transform: translate($x, $y);<br />
     -moz-transform: translate($x, $y);<br />
      -ms-transform: translate($x, $y);<br />
       -o-transform: translate($x, $y);<br />
          transform: translate($x, $y);<br />
}<br />
@mixin skew($x, $y) {<br />
  -webkit-transform: skew($x, $y);<br />
     -moz-transform: skew($x, $y);<br />
      -ms-transform: skew($x, $y);<br />
       -o-transform: skew($x, $y);<br />
          transform: skew($x, $y);<br />
}<br />
@mixin translate3d($x, $y, $z) {<br />
  -webkit-transform: translate3d($x, $y, $z);<br />
     -moz-transform: translate3d($x, $y, $z);<br />
       -o-transform: translate3d($x, $y, $z);<br />
          transform: translate3d($x, $y, $z);<br />
}</p>
<p>//Add opacity to elements<br />
@mixin opacity($opacity){<br />
    -ms-filter: &#8220;progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$opacity}*10)&#8221;;<br />
    filter: alpha(opacity=#{$opacity}*100);<br />
    -moz-opacity: $opacity;<br />
    -khtml-opacity: $opacity;<br />
    opacity: $opacity;<br />
}</p>
<p>// Add an alphatransparency value to any background or border color<br />
@mixin translucent-background($color: #fff, $alpha: 0.5) {<br />
    background: $color; //fallback<br />
    background: hsla(hue($color), saturation($color), lightness($color), $alpha);<br />
}<br />
@mixin translucent-border($size: 1px, $style: solid, $color: #fff, $alpha: 0.5) {<br />
    border: $size $style hsla(hue($color), saturation($color), lightness($color), $alpha);<br />
    background-clip: padding-box;<br />
}</p>
<p>//gradients<br />
@mixin gradient-horizontal($startColor: #555, $endColor: #333, $noGradient: #444){<br />
    background: $noGradient;<br />
    background: -moz-linear-gradient(left, $startColor, $endColor) repeat-x $endColor; // FF 3.6+<br />
    background: -webkit-gradient(linear, 0 0, 100% 0, from($startColor), to($endColor) repeat-x $endColor); // Safari 4+, Chrome 2+<br />
    background: -webkit-linear-gradient(left, $startColor, $endColor) repeat-x $endColor; // Safari 5.1+, Chrome 10+<br />
    background: -o-linear-gradient(left, $startColor, $endColor) repeat-x $endColor repeat-x $endColor; // Opera 11.10<br />
    background: linear-gradient(to right, $startColor, $endColor) repeat-x $endColor; // Standard, IE10<br />
}<br />
 @mixin gradient-vertical($startColor: #eee, $endColor: #aaa, $noGradient: #ccc){<br />
    background: $noGradient;<br />
    background: -moz-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // FF 3.6+<br />
    background: -webkit-gradient(linear, 0 0, 0 100%, from($startColor), to($endColor)) repeat-x mix($startColor, $endColor, 60%); // Safari 4+, Chrome 2+<br />
    background: -webkit-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Safari 5.1+, Chrome 10+<br />
    background: -o-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Opera 11.10<br />
    background: linear-gradient(to bottom, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Standard, IE10<br />
}<br />
@mixin gradient-directional($startColor: #555, $endColor: #333, $deg: 45, $noGradient: #444){<br />
    background: $noGradient;<br />
    background: -moz-linear-gradient(#{$deg}deg, $startColor, $endColor) repeat-x $endColor; // FF 3.6+<br />
    background: -webkit-linear-gradient(#{$deg}deg, $startColor, $endColor) repeat-x $endColor; // Safari 5.1+, Chrome 10+<br />
    background: -o-linear-gradient(#{$deg}deg, $startColor, $endColor) repeat-x $endColor; // Opera 11.10<br />
    background: linear-gradient(#{$deg}deg, $startColor, $endColor) repeat-x $endColor; // Standard, IE10<br />
}<br />
@mixin gradient-vertical-three-colors($startColor: #00b3ee, $midColor: #7a43b6, $colorStop: 50%, $endColor: #c3325f, $noGradient: #444){<br />
    background: $noGradient;<br />
    background: -webkit-gradient(linear, 0 0, 0 100%, from($startColor), color-stop($colorStop, $midColor), to($endColor)) no-repeat mix($midColor, $endColor, 80%);<br />
    background: -webkit-linear-gradient($startColor, $midColor $colorStop, $endColor) no-repeat mix($midColor, $endColor, 80%);<br />
    background: -moz-linear-gradient(top, $startColor, $midColor $colorStop, $endColor) no-repeat mix($midColor, $endColor, 80%);<br />
    background: -o-linear-gradient($startColor, $midColor $colorStop, $endColor) no-repeat mix($midColor, $endColor, 80%);<br />
    background: linear-gradient($startColor, $midColor $colorStop, $endColor) no-repeat mix($midColor, $endColor, 80%);<br />
}<br />
@mixin gradient-vertical-button($highlightColor: #fbeda1, $topColor: #FFBB02, $bottomColor: #EB6900, $shadowColor: #b07504){<br />
    background: $bottomColor;<br />
    background: -moz-linear-gradient(top,  $highlightColor 0%, $topColor 4%, $bottomColor 95%, $shadowColor 100%);<br />
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$highlightColor), color-stop(4%,$topColor), color-stop(95%,$bottomColor), color-stop(100%,$shadowColor));<br />
    background: -webkit-linear-gradient(top,  $highlightColor 0%,$topColor 4%,$bottomColor 95%,$shadowColor 100%);<br />
    background: -o-linear-gradient(top,  $highlightColor 0%,$topColor 4%,$bottomColor 95%,$shadowColor 100%);<br />
    background: -ms-linear-gradient(top,  $highlightColor 0%,$topColor 4%,$bottomColor 95%,$shadowColor 100%);<br />
    background: linear-gradient(to bottom,  $highlightColor 0%,$topColor 4%,$bottomColor 95%,$shadowColor 100%);<br />
}<br />
@mixin gradient-radial($innerColor: #555, $outerColor: #333,$noGradient: #444){<br />
    background: $noGradient;<br />
    background: -webkit-gradient(radial, center center, 0, center center, 460, from($innerColor), to($outerColor)) no-repeat $outerColor;<br />
    background: -webkit-radial-gradient(circle, $innerColor, $outerColor) no-repeat $outerColor;<br />
    background: -moz-radial-gradient(circle, $innerColor, $outerColor) no-repeat $outerColor;<br />
    background: -o-radial-gradient(circle, $innerColor, $outerColor) no-repeat $outerColor;<br />
}</p>
<p>// triangles ($direction can be: up, down, left, right, up-right, up-left, down-righ or down-left)<br />
@mixin triangle($size, $color, $direction) {<br />
    height: 0;<br />
    width: 0;</p>
<p>    @if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) {<br />
        border-color: transparent;<br />
        border-style: solid;<br />
        border-width: $size / 2;</p>
<p>        @if $direction == up {<br />
            border-bottom-color: $color;<br />
        } @else if $direction == right {<br />
            border-left-color: $color;<br />
        } @else if $direction == down {<br />
            border-top-color: $color;<br />
        } @else if $direction == left {<br />
            border-right-color: $color;<br />
        }<br />
    }</p>
<p>    @else if ($direction == up-right) or ($direction == up-left) {<br />
        border-top: $size solid $color;</p>
<p>        @if $direction == up-right {<br />
            border-left: $size solid transparent;<br />
        } @else if $direction == up-left {<br />
            border-right: $size solid transparent;<br />
        }<br />
    }</p>
<p>    @else if ($direction == down-right) or ($direction == down-left) {<br />
        border-bottom: $size solid $color;</p>
<p>        @if $direction == down-right {<br />
            border-left: $size solid transparent;<br />
        } @else if $direction == down-left {<br />
            border-right: $size solid transparent;<br />
        }<br />
    }<br />
}</p>
<p>//hide text for use with background images<br />
@mixin hide-text{<br />
    overflow:hidden;<br />
    text-indent:-9999px;<br />
    display:block;<br />
}</p>
<p>//for custom @font-face<br />
@mixin family($family: &#8221;, $url: &#8216;/fonts/&#8217;, $weight: normal, $style: normal) {<br />
  @font-face {<br />
    font-family: $family;<br />
    src: url(&#8216;#{$url}.eot&#8217;);<br />
    src: url(&#8216;#{$url}.eot?#iefix&#8217;) format(&#8216;embedded-opentype&#8217;),<br />
         url(&#8216;#{$url}.woff&#8217;) format(&#8216;woff&#8217;),<br />
         url(&#8216;#{$url}.ttf&#8217;) format(&#8216;truetype&#8217;),<br />
         url(&#8216;#{$url}.svg#svg&#8217;) format(&#8216;svg&#8217;);<br />
    font-weight: $weight;<br />
    font-style: $style;<br />
  }<br />
}</p>
<p>// Clearfix for clearing floats like a boss (from h5bp.com/q)<br />
@mixin clearfix() {<br />
    zoom: 1;<br />
    &#038;:before,<br />
    &#038;:after {<br />
        display: table;<br />
        content: &#8220;&#8221;;<br />
        zoom: 1;<br />
    }<br />
    &#038;:after {<br />
        clear: both;<br />
    }<br />
}</p>
<p>// browser specific&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
@mixin ie7-inline-block() {<br />
    vertical-align: baseline; // for all other browsers<br />
    *vertical-align: auto; // set for consistency in IE7<br />
    *display: inline; // IE7 inline-block hack<br />
    *zoom: 1; //enables hasLayout<br />
}</p>
<p>// IE7 likes to collapse whitespace on either side of the inline-block elements.<br />
// Ems because we&#8217;re attempting to match the width of a space character. Left<br />
// version is for form buttons, which typically come after other elements, and<br />
// right version is for icons, which come before. Applying both is ok, but it will<br />
// mean that space between those elements will be .6em (~2 space characters) in IE7,<br />
// instead of the 1 space in other browsers.<br />
@mixin ie7-restore-left-whitespace() {<br />
    *margin-left: .3em;</p>
<p>    &#038;:first-child {<br />
        *margin-left: 0;<br />
    }<br />
}</p>
<p>@mixin ie7-restore-right-whitespace() {<br />
    *margin-right: .3em;   </p>
<p>    &#038;:last-child {<br />
        *margin-left: 0;<br />
    }<br />
}</p>
<p>[/CSS]</p>
<h2>Conclusion</h2>
<p>I hope that this tutorial helped you understand mixins better and that these free mixins will help you on your next Sass project. If you have other mixins that you think might be helpful, let me know in the comments and I&#8217;ll include them to the list.</p>
<p><strong>Also, please don&#8217;t forget to sign up to the mailing list to get a monthly newsletter of tutorials just like this.</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Other Articles you might like:</strong></p>
<ul>
<li><a href="http://hallofhavoc.com/2013/05/using-extensible-css-preprocessor-languages-sass-or-less/">Using Extensible CSS Preprocessor Languages: Sass or LESS</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/06/free-sass-mixins-for-your-next-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Extensible CSS Preprocessor Languages: Sass or LESS</title>
		<link>http://hallofhavoc.com/2013/05/using-extensible-css-preprocessor-languages-sass-or-less/</link>
		<comments>http://hallofhavoc.com/2013/05/using-extensible-css-preprocessor-languages-sass-or-less/#comments</comments>
		<pubDate>Fri, 31 May 2013 21:32:44 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[mixins]]></category>
		<category><![CDATA[pre-compiler]]></category>
		<category><![CDATA[preprocessor]]></category>
		<category><![CDATA[sass]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=973</guid>
		<description><![CDATA[What are Extensible CSS Preprocessor Languages? So you&#8217;re probably wondering to yourself: What are these extensible CSS preprocessor languages and why should I use them? You might also be asking to yourself, why I should even learn a new way of writing CSS when I already know how to write it well? The answer is [...]]]></description>
				<content:encoded><![CDATA[<h1>What are Extensible CSS Preprocessor Languages?</h1>
<p><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/sass_vs_less.jpg" alt="Sass or Less" width="500" height="300" class="alignnone size-full wp-image-1117" /><br />
So you&#8217;re probably wondering to yourself: What are these extensible CSS preprocessor languages and why should I use them? You might also be asking to yourself, why I should even learn a new way of writing CSS when I already know how to write it well? The answer is simple&#8230; It&#8217;ll make you write CSS even faster, more proficient, and will also let you split up your CSS so you can re-use some of it in another section of your site without having to re-write your CSS again.<span id="more-973"></span>But before, we dive into the nitty gritty of extensible CSS preprocessor languages, let&#8217;s find out what they are and how they are used.</p>
<p>There are a few different ones out there but the two major extensible CSS preprocessor languages for CSS are Sass (Syntatically Awesome Stylesheets) and LESS (The Dynamic Styesheet Language).</p>
<p>Let&#8217;s take a look as some of the similarities and differences between the two to get a better understanding of how each language handles CSS.</p>
<h2>Sass</h2>
<p><a href="http://sass-lang.com"><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/sass.gif" alt="Sass" width="217" height="238" class="alignnone size-full wp-image-1111" /></a><br />
Sass has been around longer than LESS and has slightly a few more features that may be useful to web designers. There are two different syntaxes when using Sass and both are valid to use. They are differentiated by an extension of the file: &#8220;.sass&#8221; and &#8220;.scss&#8221;</p>
<p>There are no functional differences between the two syntaxes except for how it is written. &#8220;.sass&#8221; files (the older syntax) uses indents/tab spaces (similar to HAML) for its syntax usage which some prefer for it&#8217;s conciseness. The other syntax &#8220;.scss&#8221; is much more commonly used and uses the same basic CSS syntax using brackets and is less concise. For this article, I&#8217;ll mainly be talking about using the &#8220;.scss&#8221; extension syntax as it is similar to writing normal CSS and has a similar syntax to LESS as well.</p>
<p>Here are a few features that encompass the Sass language:</p>
<h3>Variables</h3>
<p>Variables can be used to hold specific values that you can reuse later on and throughout your Sass file(s). They are applied by using the dollar sign <strong>($)</strong>. Here&#8217;s some examples of using variables.</p>
<p>[CSS]<br />
$red: #ff0000;<br />
$lineheight: 1.4em;<br />
p {<br />
      color: $red;<br />
      line-height: $lineheight;<br />
}<br />
[/CSS]<br />
The output will be:<br />
[CSS]<br />
p {<br />
      color: #ff0000;<br />
      line-height: 1.4em;<br />
}<br />
[/CSS]</p>
<h3>Comments</h3>
<p>There are now two ways to use comments within your Sass files instead of using the normal /* */ syntax in CSS.<br />
[CSS]<br />
// this is a comment and won&#8217;t show up on the compiled CSS file<br />
/* this is the normal<br />
two line comment */<br />
p {<br />
 	color: #333; //dark color<br />
}<br />
[/CSS]<br />
And here is the output<br />
[CSS]<br />
p {<br />
 	color: #333;<br />
}<br />
[/CSS]</p>
<h3>Nesting</h3>
<p>Nesting is the most useful feature for CSS preprocessor languages as it is easier to avoid repetition by nesting selectors within one another.<br />
[CSS]<br />
.content {<br />
      margin: 10px;</p>
<p>      h1 {<br />
            font-size: 2em;</p>
<p>            a {<br />
                  color: #0000ff;</p>
<p>                  &#038;:hover {<br />
                        color: #000099;<br />
                  }<br />
            }<br />
      }<br />
}<br />
[/CSS]<br />
And here is the output:<br />
[CSS]<br />
.content {<br />
      margin: 10px;<br />
}<br />
.content h1 {<br />
      font-size: 2em;<br />
}<br />
.content h1 a {<br />
      color: #0000ff;<br />
}<br />
.content h1 a:hover {<br />
      color: #000099;<br />
}<br />
[/CSS]</p>
<h3>Mixins</h3>
<p>Mixins are extremely useful if you constantly need to write large chunks of code and re-use them. Below is an example of a background gradient being applied using a mixin called gradient-vertical() with values set as default. Notice how there are three default values set as variables within the mixin itself which can be overwritten. </p>
<p>[CSS]<br />
 @mixin gradient-vertical($startColor: #555, $endColor: #333, $noGradient: #444){<br />
 	background: $noGradient;<br />
 	background: -moz-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // FF 3.6+<br />
 	background: -webkit-gradient(linear, 0 0, 0 100%, from($startColor), to($endColor)) repeat-x mix($startColor, $endColor, 60%); // Safari 4+, Chrome 2+<br />
 	background: -webkit-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Safari 5.1+, Chrome 10+<br />
 	background: -o-linear-gradient(top, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Opera 11.10<br />
 	background: linear-gradient(to bottom, $startColor, $endColor) repeat-x mix($startColor, $endColor, 60%); // Standard, IE10<br />
}</p>
<p>.content {<br />
 	@include gradient-vertical();<br />
}<br />
.blueBox {<br />
 	@include gradient-vertical(#40a3db, #0c78b7, #228ac6);<br />
}<br />
[/CSS]</p>
<p>Here&#8217;s the output<br />
[CSS]<br />
.content {<br />
 	background: #444444;<br />
 	background: -moz-linear-gradient(top, #555555, #333333) repeat-x #474747;<br />
 	background: -webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#333333)) repeat-x #474747;<br />
 	background: -webkit-linear-gradient(top, #555555, #333333) repeat-x #474747;<br />
 	background: -o-linear-gradient(top, #555555, #333333) repeat-x #474747;<br />
 	background: linear-gradient(to bottom, #555555, #333333) repeat-x #474747;<br />
}</p>
<p>.blueBox {<br />
 	background: #228ac6;<br />
 	background: -moz-linear-gradient(top, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
 	background: -webkit-gradient(linear, 0 0, 0 100%, from(#40a3db), to(#0c78b7)) repeat-x #2b91cc;<br />
 	background: -webkit-linear-gradient(top, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
 	background: -o-linear-gradient(top, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
 	background: linear-gradient(to bottom, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
}<br />
[/CSS]</p>
<h3>Inheritance through extends</h3>
<p>Sass allows you to inherit all the styles of a selector and apply it to another one using the @extend method.</p>
<p>[CSS]<br />
.content {<br />
 	background: #ccc;<br />
 	color: #333;<br />
}<br />
.container {<br />
 	@extend .content;<br />
 	width: 1000px;<br />
}<br />
[/CSS]</p>
<p>Here&#8217;s the output:<br />
[CSS]<br />
.content {<br />
 	background: #ccc;<br />
 	color: #333;<br />
}<br />
.container {<br />
 	background: #ccc;<br />
 	color: #333;<br />
 	width: 1000px;<br />
}<br />
[/CSS]</p>
<h3>Anything Else?</h3>
<p>Well there are many more features that Sass includes including <a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#functions">functions</a>, <a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#operations">math operations</a>, <a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#control_directives">control directives</a>, and <a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html">many more</a>. The ones that I&#8217;ve shown are the most commonly used, but you can view more about Sass&#8217;s features at <a href="http://www.sass-lang.com">www.sass-lang.com</a></p>
<h2>LESS</h2>
<p><a href="http://lesscss.org/"><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/less.png" alt="Less" width="199" height="81" class="alignnone size-full wp-image-1112" /></a><br />
LESS is very similar to Sass and has a fairly good amount of features. One of the huge differences with LESS is its syntax usage of the &#8220;@&#8221; symbol for use as the variable denotation. Also, there are slight differences between how mixins are called and how inheritance is denoted. </p>
<h3>Variables</h3>
<p>Much like Sass, variables are used to hold values for later use. Here&#8217;s an example of how to use variables in LESS:</p>
<p>[CSS]<br />
@red: #ff0000;<br />
@lineheight: 1.4em;<br />
p {<br />
      color: @red;<br />
      line-height: @lineheight;<br />
}<br />
[/CSS]<br />
The output will be:<br />
[CSS]<br />
p {<br />
      color: #ff0000;<br />
      line-height: 1.4em;<br />
}<br />
[/CSS]</p>
<p><strong>Notice however, that LESS uses the &#8220;@variable-name&#8221; followed by a colon (:) instead of an equal sign (=) to apply its value as opposed to Sass.</strong></p>
<h3>Comments</h3>
<p>Comments in LESS are used the same way they are used in Sass. There is no difference.</p>
<p>[CSS]<br />
// this is a comment and won&#8217;t show up on the compiled CSS file<br />
/* this is the normal<br />
two line comment */<br />
p {<br />
 	color: #333; //dark color<br />
}<br />
[/CSS]<br />
And here is the output:<br />
[CSS]<br />
p {<br />
 	color: #333;<br />
}<br />
[/CSS]</p>
<h3>Nesting</h3>
<p>Nesting is also used the exact same way in LESS as it is in Sass.</p>
<p>[CSS]<br />
.content {<br />
      margin: 10px;</p>
<p>      h1 {<br />
            font-size: 2em;</p>
<p>            a {<br />
                  color: #0000ff;</p>
<p>                  &#038;:hover {<br />
                        color: #000099;<br />
                  }<br />
            }<br />
      }<br />
}<br />
[/CSS]<br />
And here is the output<br />
[CSS]<br />
.content {<br />
      margin: 10px;<br />
}<br />
.content h1 {<br />
      font-size: 2em;<br />
}<br />
.content h1 a {<br />
      color: #0000ff;<br />
}<br />
.content h1 a:hover {<br />
      color: #000099;<br />
}<br />
[/CSS]</p>
<h3>Mixins</h3>
<p>Mixins are used slightly different in LESS as they are in Sass. You&#8217;ll notice that calling a mixin in LESS is just declaring its selector as opposed to calling the &#8220;@include&#8221; in Sass. Here&#8217;s an example:</p>
<p>[CSS]<br />
.gradient-vertical(@startColor: #555, @endColor: #333, @noGradient: #444){<br />
 	background: @noGradient;<br />
 	background: -moz-linear-gradient(top, @startColor, @endColor) repeat-x mix(@startColor, @endColor, 60%); // FF 3.6+<br />
 	background: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)) repeat-x mix(@startColor, @endColor, 60%); // Safari 4+, Chrome 2+<br />
 	background: -webkit-linear-gradient(top, @startColor, @endColor) repeat-x mix(@startColor, @endColor, 60%); // Safari 5.1+, Chrome 10+<br />
 	background: -o-linear-gradient(top, @startColor, @endColor) repeat-x mix(@startColor, @endColor, 60%); // Opera 11.10<br />
 	background: linear-gradient(to bottom, @startColor, @endColor) repeat-x mix(@startColor, @endColor, 60%); // Standard, IE10<br />
}</p>
<p>.content {<br />
 	.gradient-vertical; //notice how I am just calling it without brackets and it will still inherit the default values<br />
}<br />
.blueBox {<br />
 	.gradient-vertical(#40a3db, #0c78b7, #228ac6);<br />
}<br />
[/CSS]</p>
<p>Here&#8217;s the output:<br />
[CSS]<br />
.content {<br />
 	background: #444444;<br />
 	background: -moz-linear-gradient(top, #555555, #333333) repeat-x #474747;<br />
 	background: -webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#333333)) repeat-x #474747;<br />
 	background: -webkit-linear-gradient(top, #555555, #333333) repeat-x #474747;<br />
 	background: -o-linear-gradient(top, #555555, #333333) repeat-x #474747;<br />
 	background: linear-gradient(to bottom, #555555, #333333) repeat-x #474747;<br />
}</p>
<p>.blueBox {<br />
 	background: #228ac6;<br />
 	background: -moz-linear-gradient(top, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
 	background: -webkit-gradient(linear, 0 0, 0 100%, from(#40a3db), to(#0c78b7)) repeat-x #2b91cc;<br />
 	background: -webkit-linear-gradient(top, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
 	background: -o-linear-gradient(top, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
 	background: linear-gradient(to bottom, #40a3db, #0c78b7) repeat-x #2b91cc;<br />
}<br />
[/CSS]</p>
<h3>Inheritance</h3>
<p>In LESS, inheritance is declared by just calling out the already declared  selector:</p>
<p>[CSS]<br />
.content {<br />
 	background: #ccc;<br />
 	color: #333;<br />
}<br />
.container {<br />
 	.content;<br />
 	width: 1000px;<br />
}<br />
[/CSS]</p>
<p>Here&#8217;s the output:<br />
[CSS]<br />
.content {<br />
 	background: #ccc;<br />
 	color: #333;<br />
}<br />
.container {<br />
 	background: #ccc;<br />
 	color: #333;<br />
 	width: 1000px;<br />
}<br />
[/CSS]</p>
<h3>Anything else?</h3>
<p>There are many more features that encompass LESS. You can learn more by visiting <a href="http://lesscss.org">http://lesscss.org</a> or you can view its <a href="http://lesscss.org/#usage">usage</a> and <a href="http://lesscss.org/#reference">function reference</a> as well.</p>
<h2>The process of pre-compiling your CSS</h2>
<p>As well all know, browsers only understand stylesheets with the extension &#8220;.css&#8221;&#8230; plain and simple. However, with the new way of writing lines of css, we will have to use pre-compilers to compile our Sass/LESS code into a .css extension stylesheet that browsers understand. This just means that we will be writing our css code in a different way than normal and compile it so that it spits out a file (with the extension of &#8220;.css&#8221;) that browsers can understand.</p>
<h3>What pre-compiler options do I have?</h3>
<p>There are a few pre-compilers that I use which can help you compile your Sass or LESS files into readable .css files. </p>
<p><a href="http://incident57.com/codekit/"><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/codekit.png" alt="CodeKit" width="323" height="85" class="alignnone size-full wp-image-1113" /></a><br />
The main one I use is called <a href="http://incident57.com/codekit/">Codekit</a>. While it is only a Mac application at the moment, it is worth every penny, especially if you work on both Sass and LESS files(like me) and are using a Mac. It can also compress your files and has features for other languages as well.</p>
<p><a href="http://alphapixels.com/prepros/"><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/Prepos.png" alt="Prepros" width="112" height="34" class="alignnone size-full wp-image-1114" /></a><br />
<a href="http://alphapixels.com/prepros/">Prepros</a> is another great software that can compile both Sass and LESS files and is FREE! Who doesn&#8217;t like free? Plus, it&#8217;s almost the equivalent to Codekit except this is currently only for Windows users. So, Windows users rejoice!</p>
<p><a href="http://compass.handlino.com/"><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/compassapp.png" alt="Compass app" width="446" height="89" class="alignnone size-full wp-image-1115" /></a><br />
<a href="http://compass.handlino.com/">Compass.app</a> is another tool you can use to compile your Sass with Compass files.It&#8217;s only $10 and also for PC/Mac/Linux.</p>
<p><a href="http://wearekiss.com/simpless"><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/simpLESS.png" alt="SimpLESS" width="170" height="49" class="alignnone size-full wp-image-1116" /></a><br />
<a href="http://wearekiss.com/simpless">SimpLess</a>, as you may have guessed by now, is a pre-compiler for Less files and has a few great options for compiling your LESS files. It is also available for PC and Mac.</p>
<h2>So, Which extensible CSS preprocessor language should I use?</h2>
<p>While Sass has slightly more robust features (such as control directives), LESS is becoming more and more robust in its own right and is being used more and more. It really depends upon your own personal preference. I still use LESS for certain projects which involve using the <a href="http://twitter.github.io/bootstrap/">Twitter Bootstrap Framework</a> for some of my websites, but I also am currently using Sass as my primary extensible CSS preprocessor language because of its other features and because it also can be used with the <a href="http://compass-style.org/">Compass Framework</a> and can be used with the <a href="http://foundation.zurb.com/">Foundation Framework</a>.</p>
<h2>Conclusion</h2>
<p>Hopefully I&#8217;ve provided you some helpful insight into using these new CSS preprocessor languages that you can use on your next big project. By using these new CSS languages, you can save a ton of time when developing and styling your websites.</p>
<p>Let me know in the comments below which language you like best and why. Also, don&#8217;t forget to share this with others to let them know about these two awesome extensible CSS languages. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/05/using-extensible-css-preprocessor-languages-sass-or-less/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How To Create A Beautiful Dropdown Menu Using Only HTML and CSS3</title>
		<link>http://hallofhavoc.com/2013/05/how-to-create-a-beautiful-dropdown-menu-using-only-html-and-css3/</link>
		<comments>http://hallofhavoc.com/2013/05/how-to-create-a-beautiful-dropdown-menu-using-only-html-and-css3/#comments</comments>
		<pubDate>Tue, 28 May 2013 18:55:30 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[nav]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=1081</guid>
		<description><![CDATA[Dropdown lists as a navigation menu is commonly used as a way to help users navigate through a website. Creating them can sometimes be a bit difficult and some require more code than necessary, especially when you include jQuery or other JavaScript functionality into them. However, today I&#8217;ll show you a quick, easy, and beautiful [...]]]></description>
				<content:encoded><![CDATA[<p>Dropdown lists as a navigation menu is commonly used as a way to help users navigate through a website. Creating them can sometimes be a bit difficult and some require more code than necessary, especially when you include jQuery or other JavaScript functionality into them. However, today I&#8217;ll show you a quick, easy, and beautiful way of creating a dropdown navigation using only HTML and CSS3.<span id="more-1081"></span></p>
<h2>The HTML Structure</h2>
<p>First let&#8217;s start off with a simple unordered list of nav items.</p>
<p>[HTML]<br />
<html><br />
<head></p>
<link href='dropdown.css' rel='stylesheet' type='text/css'/>
</head><br />
<body></p>
<ul id="nav">
<li><a href="/">Home</a></li>
<li><a href="/">About</a></li>
<li><a href="/design">Design</a>
<ul>
<li><a href="/design/webdesign">Web</a></li>
<li><a href="/design/graphicdesign">Graphic</a></li>
</ul>
</li>
<li><a href="/tutorials">Tutorials</a>
<ul>
<li><a href="/design/webdesign">Web</a>
<ul>
<li><a href="/design/webdesign/html">HTML</a></li>
<li><a href="/design/webdesign/css">CSS</a></li>
<li><a href="/design/webdesign/javascript">JavaScript</a></li>
</ul>
</li>
<li><a href="/design/graphicdesign">Graphic</a></li>
</ul>
</li>
</ul>
<p></body><br />
</html><br />
[/HTML]</p>
<p>Next, we&#8217;ll style the navigation menu. Please note that I&#8217;ll be using some CSS3 to include into the stylesheet and also including older browser fallbacks for some of the styles.</p>
<p>[CSS]<br />
body {<br />
	font-family: &#8216;Helvetica Neue&#8217;,'Helvetica&#8217;, arial, sans-serif;<br />
}<br />
#nav{<br />
	width:1000px;<br />
    margin:0 auto 10px;<br />
    padding: 0 0 0 2%;<br />
    list-style:none;<br />
    font-weight:bold;<br />
    border: 1px solid #999;<br />
    background: #ddd;</p>
<p>	background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ccc), to(#fff));<br />
	background: -webkit-linear-gradient(top, #fff, #ccc);<br />
	background: -moz-linear-gradient(top, #fff, #ccc);<br />
	background: -ms-linear-gradient(top, #fff, #ccc);<br />
	background: -o-linear-gradient(top, #fff, #ccc);<br />
	background: linear-gradient(top, #fff, #ccc);</p>
<p>    -webkit-border-radius: 30px;<br />
	-moz-border-radius: 30px;<br />
	border-radius: 30px;</p>
<p>	-moz-box-shadow: 0 1px 4px rgba(0,0,0,0.5);<br />
	-webkit-box-shadow: 0 1px 4px rgba(0,0,0,0.5);<br />
	-ms-box-shadow: 0 1px 4px rgba(0,0,0,0.5);<br />
	-o-box-shadow: 0 1px 4px rgba(0,0,0,0.5);<br />
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);<br />
}<br />
#nav li{<br />
    display: inline-block;<br />
    margin-right:10px;<br />
    position:relative;<br />
}<br />
#nav a{<br />
    display:block;<br />
    padding:14px 5px;<br />
    color:#444;<br />
    text-decoration:none;</p>
<p>    text-shadow: 0 1px 0 rgba(255,255,255,0.9);<br />
}<br />
#nav a:hover{<br />
    color:#666;<br />
    background:#999;<br />
}</p>
<p>#nav ul{<br />
    background:#fff;<br />
    background:rgba(255,255,255,0);<br />
    list-style:none;<br />
    position:absolute;<br />
    left:-9999px;<br />
}<br />
#nav ul li{<br />
    padding-top:1px;<br />
    float:none;<br />
    width: 100px; /* width of each list item in the dropdown */<br />
}<br />
#nav ul a{<br />
    white-space:nowrap;<br />
}<br />
#nav li:hover ul{<br />
    left:0;<br />
    padding: 0;<br />
}<br />
#nav li:hover a{<br />
    background:#ccc;<br />
}<br />
#nav li:hover ul li a:hover{<br />
    background:#bbb;<br />
}<br />
#nav ul ul {<br />
	display: none;<br />
	margin: 0 0 0 100px; /* left margin for the width of each dropdown item*/<br />
	padding: 0;<br />
	top: 0;<br />
}<br />
#nav li:hover ul li:hover ul {<br />
	display: block;<br />
}<br />
[/CSS]</p>
<h2>Conclusion</h2>
<p>As you can see, it&#8217;s quite simple to create your own well-designed navigation with just a few lines of HTML and CSS. As more and more browsers adapt to using CSS3, it&#8217;ll become easier for web designers to design navigation elements such as this without the need to design it in Photoshop or other software.</p>
<p>Files: <a href="http://hallofhavoc.com/wp-content/uploads/2013/05/how_to_create_dropdown_using_html_and_css.zip">how_to_create_dropdown_using_html_and_css</a></p>
<p>If you like this tutorial, please let me know in the comments below and tell me if you want more tutorials like these.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Other tutorials you might like:</strong></p>
<ul>
<li><a href="http://hallofhavoc.com/2013/05/how-to-create-an-overlay-popup-box-using-html-css-and-jquery/">How to create an overlay popup using HTML,CSS and jQuery</a></li>
<li><a href="http://hallofhavoc.com/2013/04/how-to-use-css3-transitions/">How to use CSS3 transitions</a></li>
<li><a href="http://hallofhavoc.com/2011/12/create-a-photoshop-like-button-in-css3/">Create a Photoshop-like button in CSS3</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/05/how-to-create-a-beautiful-dropdown-menu-using-only-html-and-css3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Create an Overlay Popup Box Using HTML, CSS, and jQuery</title>
		<link>http://hallofhavoc.com/2013/05/how-to-create-an-overlay-popup-box-using-html-css-and-jquery/</link>
		<comments>http://hallofhavoc.com/2013/05/how-to-create-an-overlay-popup-box-using-html-css-and-jquery/#comments</comments>
		<pubDate>Mon, 06 May 2013 20:42:23 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[popup]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=1013</guid>
		<description><![CDATA[Have you ever wondered how to some websites create an overlay popup when they click on a link or button? Perhaps you are wondering how to create an error overlay or even a simple ad popup (not recommended since those are really annoying). Well you&#8217;re in luck. I&#8217;ll break down the basic HTML structure, CSS, [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/popup_tutorial.jpg" alt="popup_tutorial" width="542" height="188" class="alignnone size-full wp-image-1078" /></p>
<p>Have you ever wondered how to some websites create an overlay popup when they click on a link or button? Perhaps you are wondering how to create an error overlay or even a simple ad popup (not recommended since those are really annoying). <span id="more-1013"></span>Well you&#8217;re in luck. I&#8217;ll break down the basic HTML structure, CSS, and JavaScript/jQuery code as well as explain the process behind the popup overlay.</p>
<h2>Basic HTML Structure</h2>
<p>Here&#8217;s the basic HTML structure that we&#8217;ll use to design the popup.</p>
<p>[HTML]<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
	&lt;script type=&#8221;text/javascript&#8221; src=&#8221;http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js&#8221;&gt;&lt;/script&gt;<br />
	&lt;script type=&#8221;text/javascript&#8221; src=&#8221;custom.js&#8221;&gt;&lt;/script&gt;<br />
	&lt;link type=&#8221;text/css&#8221; rel=&#8221;stylesheet&#8221; href=&#8221;stylesheet.css&#8221; /&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;</p>
<p>&lt;div class=&#8221;main-content&#8221;&gt;<br />
	&lt;!&#8211; Your Content Here &#8211;&gt;<br />
	&lt;p&gt;Please &lt;a class=&#8221;show-popup&#8221; href=&#8221;#&#8221;&gt;click here&lt;/a&gt; to see the popup&lt;/p&gt;<br />
&lt;/div&gt;</p>
<p>&lt;div class=&#8221;overlay-bg&#8221;&gt;<br />
	&lt;div class=&#8221;overlay-content&#8221;&gt;<br />
		&lt;p&gt;Oh My! This is a popup!&lt;/p&gt;<br />
		&lt;button&gt;Close&lt;/button&gt;<br />
	&lt;/div&gt;<br />
&lt;/div&gt;</p>
<p>&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/HTML]</p>
<h2>CSS Snippet</h2>
<p>And below is the CSS we&#8217;ll be using to style our popup overlay:</p>
<p>[CSS]<br />
* {<br />
	margin: 0;<br />
	padding: 0;<br />
	-moz-box-sizing: border-box;<br />
	-webkit-box-sizing: border-box;<br />
	box-sizing: border-box;<br />
}</p>
<p>body {<br />
	font-family: &#8216;Helvetica Neue&#8217;,'Helvetica&#8217;, Arial, sans-serif;<br />
}</p>
<p>.main-content {<br />
	height: 800px;<br />
	width: 1000px;<br />
	margin: 0 auto;<br />
}</p>
<p>.overlay-bg {<br />
	display: none;<br />
	position: fixed;<br />
	top: 0;<br />
	left: 0;<br />
	height:100%;<br />
	width: 100%;<br />
	background: #000; /* fallback */<br />
	background: rgba(0,0,0,0.75);<br />
}<br />
	.overlay-content {<br />
		background: #fff;<br />
		padding: 1%;<br />
		width: 40%;<br />
		position: relative;<br />
		top: 15%;<br />
		left: 50%;<br />
		margin: 0 0 0 -20%; /* add negative left margin for half the width to center the div */<br />
		border-radius: 4px;<br />
		box-shadow: 0 0 5px rgba(0,0,0,0.9);<br />
	}</p>
<p>	.close-btn {<br />
		cursor: pointer;<br />
		border: 1px solid #333;<br />
		padding: 2% 5%;<br />
		background: #a9e7f9; /* fallback */<br />
		background: -moz-linear-gradient(top,  #a9e7f9 0%, #77d3ef 4%, #05abe0 100%);<br />
		background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a9e7f9), color-stop(4%,#77d3ef), color-stop(100%,#05abe0));<br />
		background: -webkit-linear-gradient(top,  #a9e7f9 0%,#77d3ef 4%,#05abe0 100%);<br />
		background: -o-linear-gradient(top,  #a9e7f9 0%,#77d3ef 4%,#05abe0 100%);<br />
		background: -ms-linear-gradient(top,  #a9e7f9 0%,#77d3ef 4%,#05abe0 100%);<br />
		background: linear-gradient(to bottom,  #a9e7f9 0%,#77d3ef 4%,#05abe0 100%);<br />
		border-radius: 4px;<br />
		box-shadow: 0 0 4px rgba(0,0,0,0.3);<br />
	}<br />
	.close-btn:hover {<br />
		background: #05abe0;<br />
	}<br />
[/CSS]</p>
<h2>jQuery Snippet</h2>
<p>And here&#8217;s the jQuery snippet we&#8217;ll use to trigger the popup to display (Note: I&#8217;m using jQuery version 1.9):</p>
<p>[JAVASCRIPT]<br />
$(document).ready(function(){<br />
    // show popup when you click on the link<br />
    $(&#8216;.show-popup&#8217;).click(function(event){<br />
        event.preventDefault(); // disable normal link function so that it doesn&#8217;t refresh the page<br />
        $(&#8216;.overlay-bg&#8217;).show(); //display your popup<br />
    });</p>
<p>    // hide popup when user clicks on close button<br />
    $(&#8216;.close-btn&#8217;).click(function(){<br />
    	$(&#8216;.overlay-bg&#8217;).hide(); // hide the overlay<br />
    });<br />
});<br />
[/JAVASCRIPT]</p>
<h2>Conclusion</h2>
<p>That&#8217;s it! Try it out for yourself, or create your own version of a popup overlay. </p>
<p>If you would like to see more of these tutorials, or maybe you have a suggestion for me, let me know in the comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/05/how-to-create-an-overlay-popup-box-using-html-css-and-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Change The Default Text Selection Color Using CSS3</title>
		<link>http://hallofhavoc.com/2013/05/how-to-change-the-default-text-selection-color-using-css3/</link>
		<comments>http://hallofhavoc.com/2013/05/how-to-change-the-default-text-selection-color-using-css3/#comments</comments>
		<pubDate>Sat, 04 May 2013 18:51:02 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[colour]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[selection]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[text selection]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=1011</guid>
		<description><![CDATA[Before CSS3, there wasn&#8217;t really a way to change the default blue text selection color when you highlight some text on a webpage. With current browsers and more support for CSS3, it has been really simple to change the look and color of the text selection. [CSS] ::selection { background:#ffff33; } ::-moz-selection { background:#ffff33; } [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://hallofhavoc.com/wp-content/uploads/2013/05/text_selection.jpg" alt="text_selection" width="530" height="260" class="alignnone size-full wp-image-1076" /></p>
<p>Before CSS3, there wasn&#8217;t really a way to change the default blue text selection color when you highlight some text on a webpage. With current browsers and more support for CSS3, it has been really simple to change the look and color of the text selection.<span id="more-1011"></span></p>
<p>[CSS]<br />
::selection {<br />
    background:#ffff33;<br />
}</p>
<p>::-moz-selection {<br />
    background:#ffff33;<br />
}</p>
<p>::-webkit-selection {<br />
    background:#ffff33;<br />
}<br />
[/CSS]</p>
<p>By using the above example, it will change the background color of your selected text to yellow instead of the default light blue.</p>
<p>As you probably noticed, Firefox and Webkit-based browsers (Chrome and Safari) have their own syntax, though the latest versions should now support the normal ::selection pseudo-element syntax.</p>
<h2>Browser Support</h2>
<ul>
<li>Firefox 1.0+</li>
<li>Chrome 1+</li>
<li>IE9+</li>
<li>Opera 9.5+</li>
<li>Safari 1.1+</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/05/how-to-change-the-default-text-selection-color-using-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use CSS3 :before and :after Pseudo Elements</title>
		<link>http://hallofhavoc.com/2013/05/how-to-use-css3-before-and-after-pseudo-elements/</link>
		<comments>http://hallofhavoc.com/2013/05/how-to-use-css3-before-and-after-pseudo-elements/#comments</comments>
		<pubDate>Thu, 02 May 2013 00:57:51 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[after]]></category>
		<category><![CDATA[before]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[elements]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[pseudo]]></category>
		<category><![CDATA[pseudo-elements]]></category>
		<category><![CDATA[support]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=990</guid>
		<description><![CDATA[When you&#8217;re trying to work with HTML content that you are unable to edit (perhaps partially because of technical, work-related, or project-based), the only option to add other content without touching the HTML structure is to use the :before and :after pseudo-elements. What Are Pseudo-Elements? Now you&#8217;re probably wondering what pseudo-elements are or what they [...]]]></description>
				<content:encoded><![CDATA[<p>When you&#8217;re trying to work with HTML content that you are unable to edit (perhaps partially because of technical, work-related, or project-based), the only option to add other content without touching the HTML structure is to use the :before and :after pseudo-elements.<span id="more-990"></span></p>
<h1>What Are Pseudo-Elements?</h1>
<p>Now you&#8217;re probably wondering what pseudo-elements are or what they can do. Pseudo-elements create a &#8220;fake&#8221; element on top of another selected element. In this case, we are using the :before and :after pseudo-elements. They don&#8217;t actually change or add anything to the content. Instead, it creates a fake element either before or after the element itself which we can then use to style with.</p>
<h2>Basic :before and :after Syntax</h2>
<p>Here&#8217;s an example of the syntax:</p>
<p>[CSS]<br />
.wrap:before {<br />
    content: &#8220;hello&#8221;;<br />
}</p>
<p>.wrap:after {<br />
    content: &#8220;world&#8221;;<br />
}<br />
[/CSS]</p>
<p>As you can see, the content property has the value of &#8220;hello&#8221; and &#8220;world&#8221;. This will add the word &#8216;hello&#8217; before each .wrap class element as well as adding &#8216;world&#8217; after each of them.</p>
<p>Here&#8217;s another example on how to add an image before an element:</p>
<p>[CSS]<br />
.wrap:before {<br />
    content: &#8220;&#8221;;<br />
    display: block;<br />
    width: 250px;<br />
    height: 250px;<br />
    background: url(&#8220;images/250&#215;250.jpg&#8221;) no-repeat;<br />
}<br />
[/CSS]</p>
<p>The code is pretty self-explanatory. I am just creating a pseudo-element before my .wrap class div that is 250&#215;250 pixels using a background image. You can also add an image like so:</p>
<p>[CSS]<br />
.wrap:before {<br />
    content: url(images/250&#215;250.jpg);<br />
}<br />
[/CSS]</p>
<p>You may have noticed that I didn&#8217;t include quotes inside the url() reference. That is because if I added quotes, it will interpret it as a literal string text.</p>
<p>Also, you may have noticed I used display: block property on the previous code. The reason for that is because it allows us to create that pseudo-element into an actual block element for us to style.</p>
<p>However, you must remember that pseudo-elements are not shown in the DOM, so you won&#8217;t be able to select or see it in the source like you normally can with HTML elements. Instead, you can use Firebug or Chrome&#8217;s Developer Tools to target the pseudo-element instead.</p>
<p>Furthermore, you must remember that these pseudo-elements inherit properties that can be inherited unless it is properties that aren&#8217;t naturally inherited&#8230; (that sounded confusing). What I&#8217;m saying is that if the main element that the pseudo-element is attached to (in this case the .wrap element) has a property of, say &#8220;font-size: 1.4em&#8221;, then the pseudo-element will also inherit it. Other properties such as margin or padding are not inherited.</p>
<h1>Browser Support</h1>
<p>As with most CSS3 techniques, only the more modern browsers are able to interpret the :before and :after pseudo-elements. With that being said, I would caution you to only use the :before and :after pseudo-elements as an enhancement and not a necessity when applying it to your designs. Anyways, here are the supported browsers:</p>
<ul>
<li>Firefox 3.5+</li>
<li>Chrome 2+</li>
<li>Safari 1.3+</li>
<li>Opera 9.2+</li>
<li>IE8+</li>
<li>And all mobile browsers.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/05/how-to-use-css3-before-and-after-pseudo-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Prevent Page Zooming on Mobile Browsers</title>
		<link>http://hallofhavoc.com/2013/04/how-to-prevent-page-zooming-on-mobile-browsers/</link>
		<comments>http://hallofhavoc.com/2013/04/how-to-prevent-page-zooming-on-mobile-browsers/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 17:43:33 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=976</guid>
		<description><![CDATA[Page zoom using mobile browsers can be a great way to view certain areas on a webpage, especially if it&#8217;s difficult to see a certain area of the page. However, with mobile versions of certain websites, it may not be a useful feature if your website is already optimized for mobile viewing.By disabling the zoom [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://hallofhavoc.com/wp-content/uploads/2013/04/pinch.jpg" alt="pinch to zoom" width="418" height="303" class="alignnone size-full wp-image-1074" /></p>
<p>Page zoom using mobile browsers can be a great way to view certain areas on a webpage, especially if it&#8217;s difficult to see a certain area of the page. However, with mobile versions of certain websites, it may not be a useful feature if your website is already optimized for mobile viewing.<span id="more-976"></span>By disabling the zoom feature with the pinch-zoom/double-tap feature of mobile browsers, you can maintain the same viewable area of the website.</p>
<p>It is actually a very easy meta tag that you just need to include in the head tags of your page.<br />
[html]</p>
<p>&lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=0&#8243; /&gt;</p>
<p>[/html]</p>
<p>That&#8217;s it. Really simple. However, as a word of caution, you shouldn&#8217;t add this if the page is not a mobile version.</p>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/04/how-to-prevent-page-zooming-on-mobile-browsers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Use CSS3 Transitions</title>
		<link>http://hallofhavoc.com/2013/04/how-to-use-css3-transitions/</link>
		<comments>http://hallofhavoc.com/2013/04/how-to-use-css3-transitions/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 17:27:47 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[Effects]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[stylesheet]]></category>
		<category><![CDATA[stylesheets]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[transitions]]></category>
		<category><![CDATA[Use]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=958</guid>
		<description><![CDATA[What are CSS3 Transitions? As with many CSS3 features that have been used as of late, many of them have dealt mainly with stylizing static properties. However, with the new CSS3 transitions, you can now do some really cool transition effects for various elements.CSS3 transitions now allow you to create transition effects without the need [...]]]></description>
				<content:encoded><![CDATA[<h1>What are CSS3 Transitions?</h1>
<p>As with many CSS3 features that have been used as of late, many of them have dealt mainly with stylizing static properties. However, with the new CSS3 transitions, you can now do some really cool transition effects for various elements.<span id="more-958"></span>CSS3 transitions now allow you to create transition effects without the need of using JavaScript or jQuery to manipulate/animate that element. Instead, it allows your browser to render those transition effects by itself.</p>
<p>There are four new properties that come with the new CSS3 Transitions. They are:</p>
<pre>transition-property
transition-duration
transition-timing-function
transition-delay</pre>
<p>You can also use the transition property as a shorthand to tie all of them at once. But first, let&#8217;s go over the four transition properties and explain how they are used.</p>
<h2>transition-property</h2>
<p>The transition-property Property (yes, read that again) allows us to select which CSS property we want the transition effects to affect. Here&#8217;s some examples of using the transition-property:</p>
<pre>transition-property: none;
transition-property: all;
transition-property: background-color;
transition-property: font-size, color, height;</pre>
<p>As you can see, we can choose which CSS property we want to select to do various transitions to. By using the &#8220;all&#8221; property, we can select every property that can be transitioned. You can find a list of properties that can be animated <a title="animatable properties" href="http://www.w3.org/TR/css3-transitions/#animatable-properties" target="_blank">here</a>.</p>
<h2>transition-duration</h2>
<p>The transition-duration Property is designated to allow a certain transition to do its animation within a specified time. Here are some examples:</p>
<pre>transition-duration: 500ms;
transition-duration: 3s;
transition-duration: 8000ms, 5000ms;
transition-duration: 0;</pre>
<p>As you can see by the examples, you can also comma-separate them with different values which targets the specific transition-property we declare.</p>
<h2>transition-timing-function</h2>
<p>The transition-timing-function is really just a fancy way of determining how the transition will be done. Here are examples of all the different types of transition-timing-function:</p>
<pre>transition-timing-function: linear;
transition-timing-function: ease;
transition-timing-function: ease-in;
transition-timing-function: ease-out;
transition-timing-function: ease-in-out;
transition-timing-function: cubic-bezier(0.2, 0.4, 0.5, 0.6);</pre>
<p>All these transition-timing-function Properties can help you determine how your transition animation will be handled. For now, I suggest you use either &#8220;linear&#8221; or &#8220;ease&#8221; as they are used for most basic animations.</p>
<h2>transition-delay</h2>
<p>The transition-delay Property is an optional property that allows us to delay when the transition occurs. It accepts various times in seconds or milliseconds and can also be comma-separated to determine which properties are going to be delayed. Here are some examples:</p>
<pre>transition-delay: 2s;
transition-delay: 2000ms;
transition-delay: -2s;</pre>
<p>As you probably would have noticed, I&#8217;ve included a -2 second delay to the last example. The transition-delay property accepts negative numbers as well which will trigger the animation to occur immediately but it will make the animation appear as though it had already begun it&#8217;s animation 2 seconds ahead and continue on from there.</p>
<h2>transition</h2>
<p>Now that we know all of the four various transition properties, we can now tie them all together to create a shorthand version. Here&#8217;s an example that turns the background-color of a div class called &#8220;.animate-me&#8221; from yellow to red when hovered over.<br />
[CSS]<br />
.transition-me {<br />
    height: 100px;<br />
    width: 100px;<br />
    background-color: #ff0;<br />
    transition: background-color 3s linear 1s;<br />
}<br />
.transition-me:hover {<br />
    background-color: #f00;<br />
}</p>
<p>[/CSS]<br />
The example above will animate the background color of the div to go from yellow to red in 3 seconds linearly with a 1 second delay. Try it out for yourself.</p>
<p>&nbsp;</p>
<h2>Browser Support</h2>
<p>As with most CSS3 properties, modern browsers are the only ones capable of displaying transitions. Here&#8217;s the list of supported browsers:</p>
<ul>
<li>
<h3>Firefox 4.0+</h3>
</li>
<li>
<h3>Chrome 4.0+</h3>
</li>
<li>
<h3>IE 10+</h3>
</li>
<li>
<h3>Safari 3.1+</h3>
</li>
<li>
<h3>Opera 10.5+</h3>
</li>
</ul>
<p>&nbsp;</p>
<p>Just remember, &#8220;with great power comes great responsibility&#8230;&#8221; so use transitions sparingly as an enhancement as opposed to a requirement. Since transitions are not fully supported on most browsers, it&#8217;s best to just use them to enhance certain features on your site.</p>
<p>So now that you know how to use transitions, how have you used CSS3 transitions in your website? Leave a comment below and tell me how you used it to enhance your site.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2013/04/how-to-use-css3-transitions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Center A Website</title>
		<link>http://hallofhavoc.com/2012/08/how-to-center-a-website/</link>
		<comments>http://hallofhavoc.com/2012/08/how-to-center-a-website/#comments</comments>
		<pubDate>Fri, 10 Aug 2012 18:48:30 +0000</pubDate>
		<dc:creator>Alfonse Surigao</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[center]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[margin]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[width]]></category>

		<guid isPermaLink="false">http://hallofhavoc.com/?p=1006</guid>
		<description><![CDATA[Here&#8217;s a quick and dirty way to center a website. It&#8217;s simple really. You just need to provide two basic properties in your CSS to include in order to center the content on your website. Here&#8217;s an example of an HTML structure: [HTML] &#60;html&#62; &#60;head&#62; &#60;/head&#62; &#60;body&#62; &#60;div id=&#8221;Wrap&#8221;&#62;&#60;/div&#62; &#60;/body&#62; &#60;/html&#62; [/HTML] And here&#8217;s the [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a quick and dirty way to center a website.</p>
<p>It&#8217;s simple really. You just need to provide two basic properties in your CSS to include in order to center the content on your website.<span id="more-1006"></span></p>
<p>Here&#8217;s an example of an HTML structure:<br />
[HTML]<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>    &lt;div id=&#8221;Wrap&#8221;&gt;&lt;/div&gt;</p>
<p>&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/HTML]</p>
<p>And here&#8217;s the actual CSS snippet to center the #Wrap div.</p>
<p>[CSS]<br />
#Wrap {<br />
    width: 800px;<br />
    margin: 0 auto;<br />
}<br />
[/CSS]</p>
<p>As you can see, you only really need two properties: width and margin. Notice, however, that when using margin: 0 auto; you need to provide a definitive width size.</p>
<p>That&#8217;s really all there is to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://hallofhavoc.com/2012/08/how-to-center-a-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
