<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>Goksel Eryigit – Front-end Developer</title>
	<atom:link href="https://geryit.com/blog/feed/" rel="self" type="application/rss+xml"/>
	<link>https://geryit.com/blog</link>
	<description>Goksel Eryigit - Front-end Developer</description>
	<lastBuildDate>Mon, 17 Oct 2016 11:11:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.3</generator>
	<itunes:explicit>no</itunes:explicit><itunes:subtitle>Goksel Eryigit - Front-end Developer</itunes:subtitle><item>
		<title>Front-end development tools</title>
		<link>https://geryit.com/blog/front-end-development-tools/</link>
					<comments>https://geryit.com/blog/front-end-development-tools/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 25 Aug 2015 13:25:17 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1485</guid>

					<description><![CDATA[No need to commit dependencies to version control You declare your dependencies in bower.json so that other things can determine them easily Define a range of acceptable versions for a dependency Use different builds of a dependency for dev vs. prod You can distribute the package.json/bower.json file and everyone can get up to speed with [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul class="c7 lst-kix_r83n6ckhogfl-0 start">
<li class="c5 c6"><span class="c1">No need to commit dependencies to version control</span></li>
<li class="c5 c6"><span class="c1">You declare your dependencies in bower.json so that other things can determine them easily</span></li>
<li class="c5 c6"><span class="c1">Define a range of acceptable versions for a dependency</span></li>
<li class="c5 c6"><span class="c1">Use different builds of a dependency for dev vs. prod</span></li>
<li class="c5 c6"><span class="c1">You can distribute the package.json/bower.json file and everyone can get up to speed with a simple &#8220;jspm init, bower install&#8221;</span></li>
</ul>
<p class="c5"><span class="c1 c4">Why JSPM (+systemjs) instead of Bower</span></p>
<p class="c5 c8"><span class="c1">Bower has only one purpose-to download source files you need from the web to your hard disk.If you want to execute script files from bower, you need to create your script tags for each of them.</span></p>
<p class="c5 c8"><span class="c1">While jspm is not only a module downloader. It downloads by default systemjs that you have mentioned. You might also call it ES6 module shim. With it, you are able to use ES6, CommonJS or AMD modules in the browser without building them. Not only ES6 modules, but all the other ES6 features supported by traceur/babeljs. Also it can build the bundle for you when you need to go to production.</span></p>
<ul class="c7 lst-kix_w3g8wyfxqedz-0 start">
<li class="c5 c6"><span class="c1">Need to quickly get jquery and include it in your server-side templated html?</span></li>
<li class="c5 c6"><span class="c1">Go with bower. need to build large JS app? Go with jspm.</span></li>
</ul>
<p><span class="c1 c4">Why ES6(systemjs) over AMD(requirejs) and CommonJS(nodejs modules)?</span></p>
<p class="c5 c8"><span class="c1">CommonJS Modules</span></p>
<ul class="c7 lst-kix_igv6r6cvmoj8-0 start">
<li class="c0"><span class="c1">Compact syntax</span></li>
<li class="c0"><span class="c1">Designed for synchronous loading</span></li>
<li class="c0"><span class="c1">Main use: server</span></li>
</ul>
<p class="c5 c8"><span class="c1">AMD</span></p>
<ul class="c7 lst-kix_igv6r6cvmoj8-0">
<li class="c0"><span class="c1">Slightly more complicated syntax</span></li>
<li class="c0"><span class="c1">Designed for asynchronous loading</span></li>
<li class="c0"><span class="c1">Main use: browsers</span></li>
</ul>
<p class="c5 c8"><span class="c1">ES6 modules </span></p>
<ul class="c7 lst-kix_igv6r6cvmoj8-0">
<li class="c0"><span class="c1">Support for Ecmascript 6 (var, let, constant)</span></li>
<li class="c0"><span class="c1">New import, export and module keywords.</span><span class="c1"> </span><span class="c1">(If there is something you want others to use)</span></li>
<li class="c0"><span class="c1">The goal is to create a format that both users of CJS and of AMD are happy with</span></li>
<li class="c0"><span class="c1">You get compile time errors if you try to import something that has not been exported.</span></li>
<li class="c0"><span class="c1">You can easily load ES6 modules asynchronously.</span></li>
<li class="c0"><span class="c1">Declarative syntax (for importing and exporting).</span></li>
<li class="c0"><span class="c1">Programmatic loader API: to configure how modules are loaded and to conditionally load modules.</span></li>
<li class="c0"><span class="c1">It’s the future!</span></li>
</ul>
<p class="c5 c10"><span class="c9 c1 c4">REST &amp; SOAP services</span></p>
<p class="c5 c8"><span class="c1 c4">REST</span><span class="c1"> describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. A client can access the resource using the unique </span><span class="c1">URI</span><span class="c1"> and a representation of the resource is returned. With each new resource representation, the client is said to transfer state. While accessing RESTful resources with HTTP protocol, the URL of the resource serves as the resource identifier and GET, PUT, DELETE, POST and HEAD are the standard HTTP operations to be performed on that resource.</span></p>
<p class="c5 c8"><span class="c1 c4">SOAP</span><span class="c1"> defines a standard communication protocol (set of rules) specification for </span><span class="c1">XML</span><span class="c1">-based message exchange. SOAP uses different transport protocols, such as </span><span class="c1">HTTP</span><span class="c1"> and </span><span class="c1">SMTP</span><span class="c1">. The standard protocol HTTP makes it easier for SOAP model to tunnel across </span><span class="c1">firewalls</span><span class="c1"> and </span><span class="c1">proxies </span><span class="c1">without any modifications to the SOAP protocol. SOAP can sometimes be slower than middleware technologies like </span><span class="c1">CORBA</span><span class="c1"> or </span><span class="c1">ICE</span><span class="c1"> due to its verbose XML format.</span></p>
<p class="c5"><span class="c1 c4">REST API, using HAPI</span></p>
<p class="c5 c8"><span class="c1">Hapi.js (Node.js) web framework to build reliable/scalable apps faster.</span></p>
<p class="c5 c14"><span class="c1 c4">Key Benefits</span></p>
<ul class="c7 lst-kix_t3js2hborbje-0 start">
<li class="c5 c6"><span class="c1">Performance &#8211; WalmartLabs are the guys who found/solved the </span><span class="c1">Node.js CORE Memory Leak</span><span class="c1">they have developed Hapi following </span><span class="c1">Benchmark Driven Development</span><span class="c1"> and the result is a high-performance framework.</span></li>
<li class="c5 c6"><span class="c1">Security &#8211; they have focussed on security and battle-tested the framework during </span><span class="c1">Black Friday</span><span class="c1">(holiday shopping busy day) without incident.</span></li>
<li class="c5 c6"><span class="c1">Mobile Optimised (lightweight &#8211; built for mobile e-commerce)</span></li>
<li class="c5 c6"><span class="c1">Plugin Architecture &#8211; easy to extend/add your own modules (good ecosystem)</span></li>
<li class="c5 c6"><span class="c1">DevOps Friendly &#8211; configuration based deployment and great stats/logging see:</span><span class="c2 c1"><a class="c11" href="https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fhapijs%2Fgood&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNGUh5jaOPYpwe2NFQFTdHSqthr71w">https://github.com/hapijs/good</a></span></li>
<li class="c5 c6"><span class="c1">Built-in Caching (Redis, MongoDB or Memcached)</span></li>
<li class="c5 c6"><span class="c1">100% Test/Code Coverage (for the core) &#8211; disciplined approach to code quality.</span></li>
<li class="c5 c6"><span class="c1">Key Functionality is Built-in and there are many plugins for other functionality:</span><span class="c2 c1"><a class="c11" href="http://www.google.com/url?q=http%3A%2F%2Fhapijs.com%2Fplugins&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNHPVkUq2WA73yOAPnxKcNp6WnWi-w">http://hapijs.com/plugins</a></span></li>
</ul>
<p class="c5 c10"><span class="c9 c1 c4">Karma, Jasmine, Protractor (testing)</span></p>
<p class="c5 c8"><span class="c9 c1 c4">Karma</span><span class="c9 c1"> is a test-runner, so it run your test. </span></p>
<p class="c5 c8"><span class="c9 c1 c4">Jasmine</span><span class="c9 c1"> is the framework that let you write test.</span></p>
<p class="c5 c8"><span class="c9 c1 c4">Protractor</span><span class="c9 c1"> is made for E2E test (test navigation like a real user). It combine WebDriverJS and Jasmine and let you write End-to-End test (you simulate a real browser and taking action) with jasmine syntax.</span></p>
<p class="c5"><span class="c1 c4">Sources: </span></p>
<ul class="c7 lst-kix_fke0kwtutfnh-0 start">
<li class="c5 c6"><span class="c2 c1"><a class="c11" href="http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNFUoKKmZVS3Nibgy4xGsagbeUbT-Q">Stackoverflow.com</a></span></li>
<li class="c5 c6"><span class="c2 c1"><a class="c11" href="http://www.google.com/url?q=http%3A%2F%2Fwww.2ality.com%2F2013%2F07%2Fes6-modules.html&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNH3NlQqVBvKm3zllpwox90OBbjyeg">http://www.2ality.com/2013/07/es6-modules.html</a></span></li>
<li class="c5 c6"><span class="c1 c2"><a class="c11" href="http://www.google.com/url?q=http%3A%2F%2Fguybedford.com%2Fpractical-workflows-for-es6-modules&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNFIw2UlHXTIb1Ak7g0QjTwJRBYUuw">http://guybedford.com/practical-workflows-for-es6-modules</a></span></li>
<li class="c5 c6"><span class="c2 c1"><a class="c11" href="http://www.google.com/url?q=http%3A%2F%2Faddyosmani.com%2Fwriting-modular-js%2F&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNFBSuwR-ASkWZU01H8J0ZqTRGjhMg">http://addyosmani.com/writing-modular-js/</a></span></li>
<li class="c5 c6"><span class="c2 c1"><a class="c11" href="http://www.google.com/url?q=http%3A%2F%2Fwww.100percentjs.com%2Fjust-like-grunt-gulp-browserify-now&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNEs7Jv9uLZktBNd8qfEmdisvVB6ww">http://www.100percentjs.com/just-like-grunt-gulp-browserify-now</a></span></li>
<li class="c5 c6"><span class="c2 c1"><a class="c11" href="https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fnelsonic%2Flearn-hapi&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNHtB08r3_vkPzn8aZ5XXODWvmNjxw">https://github.com/nelsonic/learn-hapi</a></span></li>
<li class="c3 c6"></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/front-end-development-tools/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>JavaScript Fundamentals</title>
		<link>https://geryit.com/blog/javascript-fundamentals/</link>
					<comments>https://geryit.com/blog/javascript-fundamentals/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 10 Aug 2015 15:34:21 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1465</guid>

					<description><![CDATA[Good Parts1 Why JavaScript? JavaScript is an important language because it is the language of the web browser. Its association with the browser makes it one of the most popular programming languages in the world. Analyzing JavaScript JavaScript is built on some very good ideas and a few very bad ones. The very good ideas [&#8230;]]]></description>
										<content:encoded><![CDATA[<h2>Good Parts1</h2>
<h3>Why JavaScript?</h3>
<p>JavaScript is an important language because it is the language of the web browser. Its<br />
    association with the browser makes it one of the most popular programming languages<br />
    in the world.</p>
<h3>Analyzing JavaScript</h3>
<p>JavaScript is built on some very good ideas and a few very bad ones.<br />
    The very good ideas include functions, loose typing, dynamic objects, and an expressive<br />
    object literal notation. The bad ideas include a programming model based on<br />
    global variables.
</p>
<h2>Grammar2</h2>
<h3>A Simple Testing Ground</h3>
<pre class="brush:html">
&lt;html&gt;
&lt;body&gt;
&lt;script src=&quot;program.js&quot;&gt;
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Whitespace</h3>
<p><pre class="brush:js">var that = this;</pre>
<p>the space between var and that cannot be removed, but the other spaces can be<br />
removed.
</p>
<h3>Strings</h3>
<p>A string literal can be wrapped in single quotes or double quotes. It can contain zero<br />
    or more characters.</p>
<h4>Strings have methods</h4>
<pre class="brush:js">'cat'.toUpperCase( ) === 'CAT'</pre>
<h3>Statements</h3>
<pre class="brush:js">
    if(a){return true;}else{return false;}
</pre>
<h4>Operator precedence</h4>
<p>
    . [] ( ) Refinement and invocation<br />
    delete new typeof + &#8211; ! Unary operators<br />
    * / % Multiplication, division, modulo<br />
    + &#8211; Addition/concatenation, subtraction<br />
    >= <= > < Inequality
    === !== Equality
    &#038;&#038; Logical and
    || Logical or
    ?: Ternary
</p>
<h3>Literals</h3>
<p>Object literals are a convenient notation for specifying new objects. </p>
<h3>Functions</h3>
<p>A function literal defines a function value. It can have an optional name that it can<br />
    use to call itself recursively</p>
<h2>Objects</h2>
<h3>Object Literals</h3>
<pre class="brush:js">
    <script>
        var empty_object = {};
        var stooge = {
            "first-name": "Jerome",
            "last-name": "Howard"
        };
    </script>

</pre>
<h3>Retrieval</h3>
<p>Values can be retrieved from an object by wrapping a string expression in a [ ] suffix.<br />
    If the string expression is a constant, and if it is a legal JavaScript name and not a<br />
    reserved word, then the . notation can be used instead. The . notation is preferred<br />
    because it is more compact and it reads better</p>
<h2>Reference</h2>
<pre class="brush:js">
    <script>
        var x = stooge;
        x.nickname = 'Curly';
        var nick = stooge.nickname;
        // nick is 'Curly' because x and stooge
        // are references to the same object
        var a = {}, b = {}, c = {};
        // a, b, and c each refer to a
        // different empty object
        a = b = c = {};
        // a, b, and c all refer to
        // the same empty object
    </script>

</pre>
<h3>Reflection</h3>
<pre class="brush:js">
    <script>
        typeof flight.number // 'number'
        typeof flight.status // 'string'
        typeof flight.arrival // 'object'
        typeof flight.manifest // 'undefined'
    </script>

</pre>
<h3>Enumeration</h3>
<pre class="brush:js">
    <script>
        var i;
        var properties = [
            'first-name',
            'middle-name',
            'last-name',
            'profession'
        ];
        for (i = 0; i < properties.length; i += 1) {
            document.writeln(properties[i] + ': ' +
                    another_stooge[properties[i]]);
        }
    </script>

</pre>
<h3>Delete</h3>
<pre class="brush:js">
    <script>
        another_stooge.nickname // 'Moe'
        // Remove nickname from another_stooge, revealing
        // the nickname of the prototype.
        Global
        Abatement | 25
        delete another_stooge.nickname;
        another_stooge.nickname // 'Curly'
    </script>

</pre>
<h3>Global Abatement</h3>
<p>One way to minimize the use of global variables is to create a single global variable<br />
    for your application:</p>
<pre class="brush:js">
    <script>
        var MYAPP = {};
        MYAPP.stooge = {
            "first-name": "Joe",
            "last-name": "Howard"
        };
        MYAPP.flight = {
            airline: "Oceanic",
            number: 815,
            departure: {
                IATA: "SYD",
                time: "2004-09-22 14:55",
                city: "Sydney"
            },
            arrival: {
                IATA: "LAX",
                time: "2004-09-23 10:42",
                city: "Los Angeles"
            }
        };
    </script>

</pre>
<h2>Functions</h2>
<h3>Function Literal</h3>
<pre class="brush:js">
<script>
    var add = function (a, b) {
        return a + b;
    };
</script>
</pre>
<h3>The Method Invocation Pattern</h3>
<p>When a function is stored as a property of an object, we call it a method.</p>
<pre class="brush:js">
<script>
    // Create myObject. It has a value and an increment
    // method. The increment method takes an optional
    // parameter. If the argument is not a number, then 1
    // is used as the default.
    var myObject = {
        value: 0,
        increment: function (inc) {
            this.value += typeof inc === 'number' ? inc : 1;
        }
    };
</script>
</pre>
<h3>The Function Invocation Pattern</h3>
<p>When a function is not the property of an object, then it is invoked as a function:</p>
<pre class="brush:js">
<script>
    var sum = add(3, 4); // sum is 7
</script>
</pre>
<h3>The Constructor Invocation Pattern</h3>
<pre class="brush:js">
<script>
    // Create a constructor function called Quo.
    // It makes an object with a status property.
    var Quo = function (string) {
        this.status = string;
    };
    // Give all instances of Quo a public method
    30 | Chapter
    4
    :
    Functions
    // called get_status.
    Quo.prototype.get_status = function () {
        return this.status;
    };
    // Make an instance of Quo.
    var myQuo = new Quo("confused");
    document.writeln(myQuo.get_status()); // confused
</script>
</pre>
<h3>Arguments</h3>
<pre class="brush:js">
<script>
    // Make a function that adds a lot of stuff.
    // Note that defining the variable sum inside of
    // the function does not interfere with the sum
    // defined outside of the function. The function
    // only sees the inner one.
    var sum = function () {
        var i, sum = 0;
        for (i = 0; i < arguments.length; i += 1) {
            sum += arguments[i];
        }
        return sum;
    };
</script>
</pre>
<h3>Exceptions</h3>
<pre class="brush:js">
<script>
    var add = function (a, b) {
        if (typeof a !== 'number' || typeof b !== 'number') {
            throw {
                name: 'TypeError',
                message: 'add needs numbers'
            };
        }
        return a + b;
    }
</script>
</pre>
<h3>Recursion</h3>
<p>A recursive function is a function that calls itself, either directly or indirectly.</p>
<pre class="brush:js">
<script>
    var hanoi = function (disc, src, aux, dst) {
        if (disc > 0) {
            hanoi(disc - 1, src, dst, aux);
            document.writeln('Move disc ' + disc +
                    ' from ' + src + ' to ' + dst);
            hanoi(disc - 1, aux, src, dst);
        }
    };
    hanoi(3, 'Src', 'Aux', 'Dst');
</script>
</pre>
<h3>Scope</h3>
<pre class="brush:js">
<script>
    var foo = function () {
        var a = 3, b = 5;
        var bar = function () {
            var b = 7, c = 11;
// At this point, a is 3, b is 7, and c is 11
            a += b + c;
// At this point, a is 21, b is 7, and c is 11
        };
// At this point, a is 3, b is 5, and c is not defined
        bar();
// At this point, a is 21, b is 5
    };
</script>
</pre>
<h3>Closure (functions in functions)</h3>
<pre class="brush:js">
<script>
    var myObject = function () {
        var value = 0;
        return {
            increment: function (inc) {//closure (public)
                value += typeof inc === 'number' ? inc : 1;
            },
            getValue: function () {
                return value;
            }
        };
    }
    ();


    myObject.increment(5);
    myObject.getValue();
</script>
</pre>
<p>We are not assigning a function to myObject. We are assigning the result of invoking<br />
    that function. Notice the ( ) on the last line.</p>
<pre class="brush:js">
<script>

    // Create a maker function called quo. It makes an
    // object with a get_status method and a private
    // status property.
    var quo = function (status) {
        return {
            get_status: function () {
                return status;
            }
        };
    };
    // Make an instance of quo.
    var myQuo = quo("amazed");
    document.writeln(myQuo.get_status());
</script>
</pre>
<pre class="brush:js">
<script>
    // Define a function that sets a DOM node's color
    // to yellow and then fades it to white.
    var fade = function (node) {
        var level = 1;
        var step = function () {
            var hex = level.toString(16);
            node.style.backgroundColor = '#FFFF' + hex + hex;
            if (level < 15) {
                level += 1;
                setTimeout(step, 100);
            }
        };
        setTimeout(step, 100);
    };
    fade(document.body);
</script>
</pre>
<h3>Module</h3>
<pre class="brush:js">
<script>
    var serial_maker = function () {
                // Produce an object that produces unique strings. A
                // unique string is made up of two parts: a prefix
                // and a sequence number. The object comes with
                // methods for setting the prefix and sequence
                // number, and a gensym method that produces unique
                // strings.
                var prefix = '';
                var seq = 0;
                return {
                    set_prefix: function (p) {
                        prefix = String(p);
                    },
                    set_seq: function (s) {
                        seq = s;
                    },
                    gensym: function () {
                        var result = prefix + seq;
                        seq += 1;
                        return result;
                    }
                };
            }
            ;
    var seqer = serial_maker();
    seqer.set_prefix = ('Q');
    seqer.set_seq = (1000);
    var unique = seqer.gensym();
    // unique is "Q1000"

</script>
</pre>
<h3>Cascade</h3>
<pre class="brush:js">
<script>
    var mod = function () {
        return {
            move: function () {
                return {
                    width: function () {
                        return "width";
                    }
                };

            },

        }
    }()

    mod.move().width();
</script>
</pre>
<h3>Memoization</h3>
<h4>wrong:</h4>
<pre class="brush:js">
<script>
    var fibonacci = function (n) {
        return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
    };
    for (var i = 0; i <= 10; i += 1) {
        document.writeln('// ' + i + ': ' + fibonacci(i));
    }
</script>
</pre>
<h4>right</h4>
<pre class="brush:js">
<script>
    var memoizer = function (memo, fundamental) {
                var shell = function (n) {
                            var result = memo[n];
                            if (typeof result !== 'number') {
                                result = fundamental(shell, n);
                                memo[n] = result;
                            }
                            return result;
                        }
                        ;
                return shell;
            }
            ;

    var factorial = memoizer([1, 1], function (shell, n) {
                console.log(n * shell(n - 1));
            }
    );
</script>
</pre>
<h2>Inheritance</h2>
<h3>Functional</h3>
<pre class="brush:js">
<script>
    //if k null, k = {}
    var k = k || {};
    k
</script>
</pre>
<pre class="brush:js">
<script>
    var mammal = function(spec) {
                var that = {};
                that.get_name = function() {
                    return spec.name;
                }
                ;
                that.says = function() {
                    return spec.saying || ''; // return '' if spec.saying == null
                }
                ;
                return that;
            }
            ;
    var myMammal = mammal({
        name: 'Herb'
    });

    myMammal.says()
</script>
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/javascript-fundamentals/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to install Google Play Services on Genymotion Step by Step</title>
		<link>https://geryit.com/blog/how-to-install-google-play-services-on-genymotion-step-by-step/</link>
					<comments>https://geryit.com/blog/how-to-install-google-play-services-on-genymotion-step-by-step/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 22 Jun 2015 23:24:29 +0000</pubDate>
				<category><![CDATA[Cool Stuff]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1458</guid>

					<description><![CDATA[Due to Genymotion&#8217;s fluidness and ease of use, it now becomes the most popular android emulator allows&#160;android developers to test their app directly on their computer. However, it still lacks of Google Services just like Google Play Store, Google Maps, etc. on Genymotion emulator which&#160;makes us developer not be able to test those functionalities that [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 blog-content">
<p>Due to Genymotion&#8217;s fluidness and ease of use, it now becomes the most popular android emulator allows&nbsp;android developers to test their app directly on their computer.</p>
<p>However, it still lacks of Google Services just like Google Play Store, Google Maps, etc. on Genymotion emulator which&nbsp;makes us developer not be able to test those functionalities that use Google Services for example GCM Push Notifications or Google Maps.</p>
<p>Anyway it is not a problem anymore since there is some simple steps to do to make Google Services be avaiable on Genymotion with some help from <strong>CyanogenMod&#8217;s gapps</strong>.</p>
<p><strong>Step 1: Install&nbsp;ARM Translation</strong> &#8211; The secret behind Genymotion&#8217;s fluidness is its ROM is compiled to x86 to match the most popular computer&#8217;s CPU Architecture. But CyanogenMod&#8217;s gapps is compiled in ARM. That&#8217;s the reason why we can&#8217;t just simply install gapps on Genymotion. To make it works, we need to install an <strong>ARM Translation</strong> which will let those ARM apps be able to run on this x86 virtual device.</p>
<p>To install, download&nbsp;<a href="http://filetrip.net/dl?4SUOrdcMRv" target="_blank">Genymotion-ARM-Translation_v1.1zip</a>&nbsp;and then drop&amp;drop the downloaded file to an opened Genymotion virtual device. After file transfering is done, there will be a confirmation dialog like below. Just simple click <strong>OK</strong> to flash it on virtual device.</p>
<p><img decoding="async" class="width-100percent" src="http://inthecheesefactory.com/uploads/source/genymotion/armtranslationflash.jpg" alt="armtranslationflash" /></p>
<p>There will be an another dialog to let you know that the&nbsp;flashing process is done.&nbsp;</p>
<p><img decoding="async" class="width-100percent" src="http://inthecheesefactory.com/uploads/source/genymotion/armtranslationflashed.jpg" alt="armtranslationflashed" /></p>
<p>You need to reboot the virtual device now but we don&#8217;t suggest to just close the virtual device and relaunch&nbsp;it once again since it may leads to some weird behaviour. To make it done completely find, you need to reboot the device through command line like this:</p>
<pre class="brush:bash;auto-links:false;toolbar:false" contenteditable="false">adb reboot</pre>
<p>In case you accidentally close the virtual device, don&#8217;t be panic. You might need to relaunch for a few times before it can&nbsp;boot up.</p>
<p><strong>Step 2: Install gapps</strong> &#8211; Before we go on to the next step, you need to download the flashable zip of gapps by your virtual device&#8217;s Android version:</p>
<p><a href="https://www.androidfilehost.com/?fid=95784891001614559" target="_blank">Android 5.0.x</a>, <a href="https://www.androidfilehost.com/?fid=95832962473395379" target="_blank">Android 4.4.x</a>, <a href="https://www.androidfilehost.com/?fid=23060877490000124" target="_blank">Android 4.3.x</a>, <a href="https://www.androidfilehost.com/?fid=23060877490000128" target="_blank">Android 4.2.x</a>, <a href="https://www.androidfilehost.com/?fid=22979706399755082" target="_blank">Android 4.1.x</a>, <a href="https://www.androidfilehost.com/?fid=22979706399755108" target="_blank">Android 4.0.x</a>, <a href="https://www.androidfilehost.com/?fid=22979706399755027" target="_blank">Android 2.3.3</a></p>
<p>And then drop&amp;drop the downloaded file to a virtual device like previous and go through the flashing process.</p>
<p><img decoding="async" class="width-100percent" src="http://inthecheesefactory.com/uploads/source/genymotion/flashgapps.jpg" alt="flashgapps" /></p>
<p>Reboot the virtual device once again.</p>
<pre class="brush:bash;auto-links:false;toolbar:false" contenteditable="false">adb reboot</pre>
<p>After the virtual device is booted up, you will notice that <strong>Google Play services has stopped</strong>&nbsp;problem will keep popping up like this:</p>
<p><img decoding="async" class="width-100percent" src="http://inthecheesefactory.com/uploads/source/genymotion/unfortunate.jpg" alt="unfortunate" /></p>
<p>Don&#8217;t be surprised and don&#8217;t panic. You did it all right. This error happens because the installed gapps is just&nbsp;too old and didn&#8217;t match the latest ROM Genymotion provided. All you need to do is be patient and login to Google Play Store and update all of installed app.</p>
<p><img decoding="async" class="width-100percent" src="http://inthecheesefactory.com/uploads/source/genymotion/updateall.jpg" alt="updateall" /></p>
<p>And also don&#8217;t forget to update <strong>Google Play Services</strong>&nbsp;as well. It should be notified through the&nbsp;device&#8217;s notification area after your pressed the <em>Update All</em> button in Google Play Store.</p>
<p>Congratulations, Google Play Services are now available on your Genymotion virtual device. A by-product of this installation is you are also able to run the app compiled in ARM on Genymotion as well.</p>
<p><img decoding="async" class="width-100percent" src="http://inthecheesefactory.com/uploads/source/genymotion/done.jpg" alt="done" /></p>
<p>Hope you find this article helpful. =)</p>
<p><strong>Source:</strong> <a href="http://forum.xda-developers.com/showthread.php?t=2528952" target="_blank">XDA-Developers</a>, <a href="http://wiki.cyanogenmod.org/w/Google_Apps" target="_blank">CyanogenMod</a></p>
<table class="table" style="width: 100%; background-color: #f4f4f4; border-radius: 6px;">
<tbody>
<td style="border: 0px; width: 64px; padding: 16px 0px 16px 16px;"><img decoding="async" src="http://inthecheesefactory.com/themes/starter/images/profile_pic_nuuneoi2.png?a=1" width=48/></td>
<td style="border: 0px; padding: 16px;" class="small">
        Author: <strong>nuuneoi</strong></p>
<div class="text-muted small">A full-stack developer with more than 6 years experience on Android Application Development and more than 12 years in Mobile Application Development industry. Also has skill in Infrastucture, Service Side, Design, UI&amp;UX, Hardware, Optimization, Cooking, Photographing, Blogging, Training, Public Speaking and do love to share things to people in the world!</div>
</td>
</tbody>
</table>
<div>
        <a href="http://twitter.com/share" class="twitter-share-button" data-url="http://inthecheesefactory.com/blog/how-to-install-google-services-on-genymotion/en" data-count="horizontal" data-via="thecheesefact">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
<p>        <!-- Place this tag where you want the +1 button to render --><br />
        <g:plusone size="medium" href="http://inthecheesefactory.com/blog/how-to-install-google-services-on-genymotion/en"></g:plusone><br />
        <!-- Place this render call where appropriate --><br />
        <script type="text/javascript">
            (function() {
                var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
                po.src = 'https://apis.google.com/js/plusone.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
            })();
        </script></p>
<p></p>
<div class="fb-like" data-href="http://inthecheesefactory.com/blog/how-to-install-google-services-on-genymotion/en" data-width="100%" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
</p></div>
<div class="clearfix"></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/how-to-install-google-play-services-on-genymotion-step-by-step/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Speed Up WordPress: Using CDNs, Compression, and Minification to Speed Up WordPress</title>
		<link>https://geryit.com/blog/speed-up-wordpress-using-cdns-compression-and-minification-to-speed-up-wordpress/</link>
					<comments>https://geryit.com/blog/speed-up-wordpress-using-cdns-compression-and-minification-to-speed-up-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 03 Apr 2015 10:48:23 +0000</pubDate>
				<category><![CDATA[Css3]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1451</guid>

					<description><![CDATA[In the first part of this series, we reviewed caching and database optimization. In this second part, we&#8217;ll talk about compression, minification, and using a CDN. Let&#8217;s begin! Compression and Minification of Assets It&#8217;s simple math: If your page&#8217;s size is 1MB, a visitor with a 10Mbit connection can load it in 800 milliseconds. So, [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="post-body__content">
<p>In the first part of this series, we reviewed caching and<br />
                            database optimization. In this second part, we&#8217;ll talk about compression, minification, and<br />
                            using a CDN.</p>
<p>Let&#8217;s begin!</p>
<h2>Compression and Minification of Assets</h2>
<p>It&#8217;s simple math: If your page&#8217;s size is 1MB, a visitor with a 10Mbit connection can load<br />
                                it in 800 milliseconds. So, if you can reduce your page size to, say, 600KB, it would<br />
                                take only half a second for the visitor to load it.</p>
<p>Luckily, there are many ways to compress and minify your pages&#8217; CSS, JS and HTML output.<br />
                                Let&#8217;s see how:</p>
<h3>Method 1: Enabling <a href="http://en.wikipedia.org/wiki/HTTP_compression">HTTP<br />
                                Compression</a><br />
                            </h3>
<p>HTTP compression formats like gzip and deflate are used by nearly every server platform<br />
                                (including Apache and Microsoft IIS) and accepted by virtually every browser, so HTTP<br />
                                compression is most likely to run on every device and every server. (Your server might<br />
                                even enable it by default. To check it, search for &#8220;<a
                                        href="https://www.google.com.tr/search?q=http+compression+check">http<br />
                                    compression check</a>&#8220;, click one of the results, and type in your website address.)
                            </p>
<p>So how do we enable HTTP compression? There are several ways to do it, but I think these<br />
                                two can help everyone:</p>
<p><strong>1. Enable compression via <code>.htaccess</code>:</strong> If your server didn&#8217;t<br />
                                enable HTTP compression by default, you can enable it by pasting the following code into<br />
                                your <code>.htaccess</code> file (taken from the <a
                                        href="https://github.com/h5bp/html5-boilerplate">HTML5 Boilerplate</a>):</p>
<pre class="brush: plain noskimlinks noskimwords">&lt;IfModule mod_deflate.c&gt;

    # Force compression for mangled headers.
    # https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html

    &lt;IfModule mod_setenvif.c&gt;
        &lt;IfModule mod_headers.c&gt;
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        &lt;/IfModule&gt;
    &lt;/IfModule&gt;

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    # Mark certain resources as been compressed in order to:
    #
    #  1) prevent Apache from recompressing them
    #  2) ensure that they are served with the correct
    #     `Content-Encoding` HTTP response header

    &lt;IfModule mod_mime.c&gt;
        AddEncoding gzip              svgz
    &lt;/IfModule&gt;

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    # Compress all output labeled with one of the following media types.

    # IMPORTANT: For Apache versions below 2.3.7 you don't need to enable
    # `mod_filter` and can remove the `&lt;IfModule mod_filter.c&gt;` &amp; `&lt;/IfModule&gt;`
    # lines as `AddOutputFilterByType` is still in the core directives.

    &lt;IfModule mod_filter.c&gt;
        AddOutputFilterByType DEFLATE "application/atom+xml" \
                                      "application/javascript" \
                                      "application/json" \
                                      "application/ld+json" \
                                      "application/manifest+json" \
                                      "application/rss+xml" \
                                      "application/vnd.geo+json" \
                                      "application/vnd.ms-fontobject" \
                                      "application/x-font-ttf" \
                                      "application/x-web-app-manifest+json" \
                                      "application/xhtml+xml" \
                                      "application/xml" \
                                      "font/opentype" \
                                      "image/svg+xml" \
                                      "image/x-icon" \
                                      "text/cache-manifest" \
                                      "text/css" \
                                      "text/html" \
                                      "text/plain" \
                                      "text/vtt" \
                                      "text/x-component" \
                                      "text/xml"
    &lt;/IfModule&gt;

&lt;/IfModule&gt;
</pre>
<p><strong>2. Enable HTTP compression with plugins:</strong> If you don&#8217;t know how to edit<br />
                                your <code>.htaccess</code> file (or simply don&#8217;t want to do it), you can enable HTTP<br />
                                compression using the two popular caching plugins: <a
                                        href="https://wordpress.org/plugins/wp-super-cache/">WP Super Cache</a> and <a
                                        href="https://wordpress.org/plugins/w3-total-cache/">W3 Total Cache</a>. Both of<br />
                                them offer the ability to enable HTTP compression via their settings pages.</p>
<h3>Method 2: Minifying and Combining CSS and JS files</h3>
<p>Minifying assets is almost as important as compressing them. In PHP files, whitespace<br />
                                isn&#8217;t really important since they are parsed and compiled; but whitespace in HTML, CSS<br />
                                and JS files increases file size, which means that visitors will download bigger files.<br />
                                To avoid this, you can delete all unnecessary characters in your HTML, CSS and JS<br />
                                files.</p>
<p>In addition to minifying them, you can also combine multiple CSS and JS files into one<br />
                                CSS and JS file. Doing this will reduce the number of DNS lookups and browsers won&#8217;t<br />
                                download each CSS and JS file separately.</p>
<p>Minifying and combining your assets <em>manually</em> is considered bad practice and<br />
                                could be impossible in some cases. Luckily, though, it&#8217;s really easy to achieve it<br />
                                automatically with plugins. If you&#8217;re using the W3 Total Cache plugin, you can enable<br />
                                minifying and combining your CSS and JavaScript files via the plugin&#8217;s Settings page. If<br />
                                you&#8217;re not using it, you can install a separate plugin—my favorite one is <a
                                        href="http://wordpress.org/plugins/autoptimize/">Autoptimize</a>. Autoptimize<br />
                                does the job perfectly and it has some very useful options that you can manage. I&#8217;m<br />
                                using this one with WP Super Cache and I&#8217;m extremely happy with the results.</p>
<h2>Using a CDN in WordPress</h2>
<p>If your blog is more <em>visual</em> than average, if your pages are filled with images,<br />
                                or even if you&#8217;re a regular blogger and want your images to load faster, you can (and<br />
                                should) use content delivery networks (which are commonly referred to as CDNs).</p>
<h3>Why Use a CDN for a Website?</h3>
<p>The logic behind content delivery networks is to serve content more efficiently by using<br />
                                &#8220;edge servers&#8221; around the world. These servers can contain your downloadable content<br />
                                (like images, CSS files and such) and when a user visits your page, the closest edge<br />
                                server to the visitor serves the files. With low prices on bandwidth (even free,<br />
                                sometimes) and blazing fast servers, the delivery of your content will be faster than<br />
                                ever.</p>
<h3>CDN Plugins for WordPress</h3>
<p>There are more than a few plugins out there which provide synchronization of your assets<br />
                                with different CDNs, but I&#8217;ll name just a few:</p>
<ul>
<li>
                                    <strong><a href="http://wordpress.org/plugins/jetpack/">Jetpack</a>&#8216;s<br />
                                        Photon:</strong> Being one of the most popular WordPress plugins in the plugin<br />
                                    repository, Jetpack provides a number of features as &#8220;addons&#8221;. (Think of it as a<br />
                                    plugin serving many plugins.) One of the addons is called &#8220;<a
                                        href="http://jetpack.me/support/photon/">Photon</a>&#8220;, a simple and free CDN<br />
                                    service for your website. Photon will take your images and featured images in your<br />
                                    posts and pages, upload them to the servers of WP.com, and change the URLs of your<br />
                                    images with new URLs from the CDN. It will only <em>filter</em> your posts to change<br />
                                    the URLs (meaning it won&#8217;t edit your posts), so you can easily turn it off if you<br />
                                    don&#8217;t like it, but you&#8217;ll probably like it <em>a lot—</em>it&#8217;s one of the best free<br />
                                    choices for most WordPress websites.
                                </li>
<li>
                                    <strong><a href="https://wordpress.org/plugins/cloudflare/">CloudFlare</a>:</strong><br />
                                    CloudFlare is more like a proxy server which has a CDN and acts as a firewall to<br />
                                    protect your website against malicious attacks. And since you use their DNS zones,<br />
                                    the URLs of the images will stay the same but will be cached in CloudFlare&#8217;s<br />
                                    servers. But be careful—installing CloudFlare is a bit tricky. Check out <a
                                        href="http://www.wpbeginner.com/wp-tutorials/how-to-setup-cloudflare-free-cdn-in-wordpress/">WPBeginner&#8217;s<br />
                                    article</a> for more information on installing CloudFlare and using its CDN<br />
                                    features.
                                </li>
<li>
                                    <strong><a href="https://wordpress.org/plugins/w3-total-cache/">W3 Total Cache</a>:</strong><br />
                                    They didn&#8217;t name it &#8220;W3 Total Cache&#8221; for nothing. After all, this extremely popular<br />
                                    caching plugin includes the feature of integrating a CDN of your choice to your<br />
                                    website. One of the popular CDN brands, MaxCDN, has <a
                                        href="http://www.maxcdn.com/solutions/cms/wordpress-cdn/">a thorough<br />
                                    tutorial</a> on how to install its CDN inside W3 Total Cache&#8217;s settings.
                                </li>
</ul>
<h2>End of Part 2</h2>
<p>In this second part of the series, we went through compression and minification of<br />
                                assets, and using a CDN in WordPress. In the next (and last) article, we&#8217;ll see the<br />
                                importance of image optimization, and we&#8217;ll close up with some thoughts on using<br />
                                WordPress with common sense.</p>
<p>What do you think about speeding up WordPress? Share your thoughts below in the comments<br />
                                section. And if you liked the article, don&#8217;t forget to share it.</p>
<p>See you in the next part!</p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/speed-up-wordpress-using-cdns-compression-and-minification-to-speed-up-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Loading CSS without blocking render</title>
		<link>https://geryit.com/blog/loading-css-without-blocking-render/</link>
					<comments>https://geryit.com/blog/loading-css-without-blocking-render/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 03 Apr 2015 10:23:29 +0000</pubDate>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[Css3]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1445</guid>

					<description><![CDATA[This article demonstrates a technique to get content in front of visitors as quickly as possible by asynchronously downloading stylesheets to prevent them from blocking page render. Warning! I posted this with the best of intentions, but it would be irresponsible not to make readers aware of the following issues. Community feedback is coming in [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="grid grid--4">
<article class="grid__item">
<p>This article demonstrates a technique to get content in front of visitors as quickly as possible by asynchronously downloading stylesheets to prevent them from blocking page render.</p>
<div style="border-left: .2em solid #b30027; padding-left:1.5em; margin-left:-1.7em; color:#b30027"> Warning! I posted this with the best of intentions, but it would be irresponsible not to make readers aware of the following issues. Community feedback is coming in thick and fast (something I&#8217;m very grateful for) and it&#8217;s becoming apparent that this technique isn&#8217;t as robust as I&#8217;d hoped. Despite my testing and using it successfully in my own work, many developers are seeing issues in IE and Firefox (apparently crashing FF beta) while others are reporting success in Chrome and Safari. My advice right now is: DON&#8217;T use this in production. I am planning to digest the feedback and will update this post with any relevant information. </div>
<p>The principles behind these techniques aren&#8217;t new. Filament group, for example, have published great content on <a href="https://github.com/filamentgroup/loadCSS">loading CSS</a> and <a href="http://www.filamentgroup.com/lab/font-loading.html">fonts</a>. I&#8217;ve written this article to document my thoughts and ideas for loading non-blocking resources.</p>
<p>The trick to triggering an asynchronous stylesheet download is to use a <code>&lt;link&gt;</code> element and set an invalid value for the <code>media</code> attribute (I&#8217;m using <code>media="none"</code>, but any value will do). When a media query evaluates to false, the browser will still download the stylesheet, but it won&#8217;t wait for the content to be available before rendering the page.</p>
<figure class="figure">
<pre class="figure__item image codeblock"><code class="code code--html">&lt;link rel="stylesheet" href="css.css" media="none"&gt;</code></pre>
</figure>
<p>Once the stylesheet has finished downloading the <code>media</code> attribute must be set to a valid value so the style rules will be applied to the document. The <code>onload</code> event is used to switch the <code>media</code> property to <code>all</code>:</p>
<figure class="figure">
<pre class="figure__item image codeblock"><code class="code code--html">&lt;link rel="stylesheet" href="css.css" media="none" onload="if(media!='all')media='all'"&gt;</code></pre>
</figure>
<p>This method of loading CSS will deliver useable content to visitors <em>much</em> quicker than the standard approach. Critical CSS can still be served with the usual blocking approach (or you can inline it for ultimate performance) and non-critical styles can be progressively downloaded and applied later in the parsing / rendering process.</p>
<p>This technique uses JavaScript, but you can cater for non-JavaScript browsers by wrapping the equivalent blocking <code>&lt;link&gt;</code> elements in a <code>&lt;noscript&gt;</code> element:</p>
<figure class="figure">
<pre class="figure__item image codeblock"><code class="code code--html">&lt;link rel="stylesheet" href="css.css" media="none" onload="if(media!='all')media='all'"&gt;
    &lt;noscript&gt;&lt;link rel="stylesheet" href="css.css"&gt;&lt;/noscript&gt;</code></pre>
</figure>
<p>There is a side-effect to this technique. Once a non-blocking stylesheet has finished downloading the document will be repainted to reflect any new rules it defines. Injecting new styles into the page can trigger content reflows, but this is only really an issue for the <em>first</em> page load with an unprimed cache. As with all things related to performance, you&#8217;ll need to make a judgement call on when the need to control a reflow outweighs the potential speed gain.</p>
<h2 id="using-non-blocking-css-to-load-fonts">Using non-blocking CSS to load fonts</h2>
<p>Fonts are an issue for first-paint performance, they are a blocking resource and can render text invisible while they download . Using the non-blocking link example above, it&#8217;s possible to download a stylesheet containing font data in the background, unblocking the page render:</p>
<figure class="figure">
<pre class="figure__item image codeblock"><code class="code code--html">&lt;link rel="stylesheet" href="main.css"&gt;
    &lt;link rel="stylesheet" href="font.css" media="none" onload="if(media!='all')media='all'"&gt;</code></pre>
</figure>
<p><code>font.css</code> contains a base64 encoded WOFF version of the <a href="http://www.google.com/fonts/specimen/Merriweather">Merriweather font</a>.</p>
<figure class="figure">
<pre class="figure__item image codeblock"><code class="code code--css">@font-face {
    font-family: Merriweather;
    font-style: normal;
    font-weight: 400;
    src: local('Merriweather'), url('data:application/x-font-woff;charset=utf-8;base64,...')
    }</code></pre>
</figure>
<p><code>main.css</code> contains all the rules required to style the site. Here&#8217;s the font declaration:</p>
<figure class="figure">
<pre class="figure__item image codeblock"><code class="code code--css">body {
    font-family: Merriweather, "Lucida Grande", ...;
    }</code></pre>
</figure>
<p>While the font is downloading, the first matching fallback font (<strong>Lucida Grande</strong>, in this case) is used to render the page content. Once the font stylesheet is applied, <strong>Merriweather</strong> will be used. I try to ensure the fallback shares similar layout characteristics to the preferred font, so that the inevitable reflow is as subtle as possible. </p>
<p>I&#8217;m testing blocking vs non-blocking using my <a href="https://keithclark.github.io/gadebugger/">Google Analytics Debugger site</a> in Chrome over a simulated 3G connection. Local testing produces the following network graphs; notice the <code>DOMContentLoaded</code> event fires around 450ms earlier and assets begin downloading sooner when non-blocking is used:</p>
<figure class="figure">
            <span class="figure__item figure__item--inset image "><img decoding="async" loading="lazy" alt="" src="http://keithclark.co.uk/articles/loading-css-without-blocking-render/non-blocking-vs-blocking-graph.png" width="1092" height="475"></span><figcaption class="figure__caption caption">Simulated 3G network graph. Top shows blocking fonts. Bottom shows non-blocking fonts.</figcaption></figure>
<p>Deploying this to a test server and running <a href="http://www.webpagetest.org/">webpagetest</a> with 3G connection shaping produces the following timeline:</p>
<figure class="figure">
            <span class="figure__item figure__item--inset image "><img decoding="async" loading="lazy" alt="" src="http://keithclark.co.uk/articles/loading-css-without-blocking-render/non-blocking-vs-blocking-timeline1.png" width="1898" height="327"></span><figcaption class="figure__caption caption">3G timeline. Top shows blocking fonts. Bottom shows non-blocking fonts.</figcaption></figure>
<p>Both methods take 2.8 seconds to completely render the page, but the non-blocking method causes painting to being a <em>second</em> earlier than the normal blocking approach. Running the same test with the main stylesheet inlined shows a 0.7 second gain when non-blocking CSS is used to serve the font:</p>
<figure class="figure">
            <span class="figure__item figure__item--inset image "><img decoding="async" loading="lazy" alt="" src="http://keithclark.co.uk/articles/loading-css-without-blocking-render/non-blocking-vs-blocking-timeline2.png" width="1898" height="327"></span><figcaption class="figure__caption caption">3G timeline with main CSS inlined. Top shows blocking fonts. Bottom shows non-blocking fonts.</figcaption></figure>
<p>This technique does work well for fonts but I recommend keeping an eye on the new <a href="http://dev.w3.org/csswg/css-font-loading/">CSS Font Loading Module</a>, which gives far greater control over font loading.</p>
<h2 id="summary">Summary</h2>
<p>Loading fonts is one example of applying this non-blocking technique, but it could also be used for other purposes, such as separating JavaScript enhanced styles from core CSS. </p>
<p>I&#8217;ve started to experiment with the idea of breaking up CSS into scaffolding (core layout) and presentation (everything else), allowing vital page layout to block the page render and have the visual styles arrive later.</p>
<p class="note">Thanks to <a href="https://twitter.com/mathias">Mathias Bynens</a> for taking the time to share a <a href="https://twitter.com/mathias/status/581515558304219136">shortened version</a> of the <code>&lt;link&gt;</code> onload handler.</p>
<h2 id="update-1-apr-2015">Update: 1 Apr 2015</h2>
<ul class="bullet-list">
<li>This method does not work in Android &lt; 4.4 because the onload handler does not fire when content is available &#8211; I&#8217;m looking into a work around for this.</li>
<li>Some browsers appear to still block CSS render despite <code>media="none"</code>. This means CSS loads as it usually would — I&#8217;m looking into this.</li>
</ul>
</article>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/loading-css-without-blocking-render/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>APACHE SSL ON MAC OSX</title>
		<link>https://geryit.com/blog/apache-ssl-on-mac-osx/</link>
					<comments>https://geryit.com/blog/apache-ssl-on-mac-osx/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 03 Nov 2014 23:25:07 +0000</pubDate>
				<category><![CDATA[Cool Stuff]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1438</guid>

					<description><![CDATA[Update 11-12-2013: According to a commenter this process also works for OSX 10.9 Mavericks. I have recently upgraded to OSX Lion from Snow Leopard, whilst setting up my development environment I needed to configure the built in Apache server to support SSL. Below are instructions on what needed to be done. Please note that the [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="entry-content">
<p>
    <strong>Update 11-12-2013: According to a commenter this process also works for OSX 10.9 Mavericks.<br />
    </strong>
  </p>
<p>I have recently upgraded to OSX Lion from Snow Leopard, whilst setting up my development environment I needed to<br />
    configure the built in Apache server to support SSL. Below are instructions on what needed to be done. Please note<br />
    that the below is based on a clean install of OSX 10.7.2 and if you did an upgrade or are running a different<br />
    version of Lion then the instructions below may need to be tweaked to suit your setup.
  </p>
<p>&nbsp;</p>
<h2>Generate a host key</h2>
<p>First off we&#8217;ll make a home for the new SSL files. I used /private/etc/apache2/ssl. We need to change to the<br />
    new directory and then run a ssh-keygen command to create the server key file. Open up a terminal window and enter<br />
    the commands below.<br />
    <strong>Please note that you shouldn&#8217;t set a pass phrase on the certificate, just leave this blank when it<br />
      asks for a pass phrase.<br />
    </strong>
  </p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42240322219627" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
mkdir /private/etc/apache2/ssl<br />
cd /private/etc/apache2/ssl<br />
sudo ssh-keygen -f server.key</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42240322219627-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-551e666c42240322219627-2">2</div>
<div class="crayon-num" data-line="crayon-551e666c42240322219627-3">3</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42240322219627-1">
                <span class="crayon-i">mkdir</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-m">private</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">etc</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">apache2</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-e">ssl</span>
              </div>
<div class="crayon-line crayon-striped-line" id="crayon-551e666c42240322219627-2">
                <span class="crayon-i">cd</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-m">private</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">etc</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">apache2</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-e">ssl</span>
              </div>
<div class="crayon-line" id="crayon-551e666c42240322219627-3">
                <span class="crayon-e">sudo </span><br />
                <span class="crayon-i">ssh</span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-i">keygen</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-i">f</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-i">server</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">key</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0268 seconds] --></p>
<p>&nbsp;</p>
<h2>Generate a certificate request file</h2>
<p>This command creates a certificate request file. A certificate request file contains information about your<br />
    organisation that will be used in the SSL certificate. You will be asked various questions, fill these in as<br />
    appropriate or leave blank.
  </p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42254834163078" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
sudo openssl req -new -key server.key -out request.csr</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42254834163078-1">1</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42254834163078-1">
                <span class="crayon-e">sudo </span><br />
                <span class="crayon-e">openssl </span><br />
                <span class="crayon-i">req</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-r">new</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-e">key </span><br />
                <span class="crayon-i">server</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">key</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-e">out </span><br />
                <span class="crayon-i">request</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">csr</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0010 seconds] --></p>
<p>&nbsp;</p>
<h2>Create the SSL certificate</h2>
<p>Create a self signed SSL certificate using the request file.</p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c4225c965971714" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
sudo openssl x509 -req -days 365 -in request.csr -signkey server.key -out server.crt</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c4225c965971714-1">1</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c4225c965971714-1">
                <span class="crayon-e">sudo </span><br />
                <span class="crayon-e">openssl </span><br />
                <span class="crayon-i">x509</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-i">req</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-i">days</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-cn">365</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-st">in</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-i">request</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">csr</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-e">signkey </span><br />
                <span class="crayon-i">server</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">key</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-e">out </span><br />
                <span class="crayon-i">server</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">crt</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0016 seconds] --></p>
<p>&nbsp;</p>
<h2>Configure Apache</h2>
<p>
    <strong>Create a backup of /private/etc/apache2/httpd.conf.</strong>
  </p>
<p>In /private/etc/apache2/httpd.conf, make sure the SSL module is enabled (remove the # from the start of the line)
  </p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42264412839594" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
LoadModule ssl_module libexec/apache2/mod_ssl.so</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42264412839594-1">1</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42264412839594-1">
                <span class="crayon-e">LoadModule </span><br />
                <span class="crayon-e">ssl_module </span><br />
                <span class="crayon-i">libexec</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">apache2</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">mod_ssl</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">so</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0007 seconds] --></p>
<p>In the same file search for the below line and uncomment it (remove the #)</p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42272123951759" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
Include /private/etc/apache2/extra/httpd-ssl.conf</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42272123951759-1">1</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42272123951759-1">
                <span class="crayon-k ">Include</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-m">private</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">etc</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">apache2</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">extra</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">httpd</span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-i">ssl</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">conf</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0010 seconds] --></p>
<p>Edit /private/etc/apache2/extra/httpd-ssl.conf, search for the lines that start with SSLCertificateFile,<br />
    SSLCertificateKeyFile and update them to match the below:
  </p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42279434360226" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
SSLCertificateFile &#8220;/private/etc/apache2/ssl/server.crt&#8221;<br />
SSLCertificateKeyFile &#8220;/private/etc/apache2/ssl/server.key&#8221;</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42279434360226-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-551e666c42279434360226-2">2</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42279434360226-1">
                <span class="crayon-i">SSLCertificateFile</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-s">&#8220;/private/etc/apache2/ssl/server.crt&#8221;</span>
              </div>
<div class="crayon-line crayon-striped-line" id="crayon-551e666c42279434360226-2">
                <span class="crayon-i">SSLCertificateKeyFile</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-s">&#8220;/private/etc/apache2/ssl/server.key&#8221;</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0005 seconds] --></p>
<p>In the same file comment out (add a # to the beginning of the line) the lines that start with SSLCACertificatePath<br />
    and SSLCARevocationPath
  </p>
<p>&nbsp;</p>
<h2>Configure the vhosts</h2>
<p>In /private/etc/apache2/httpd.conf, search for the below line and uncomment it (remove the #)</p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42281653226105" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
Include /private/etc/apache2/extra/httpd-vhosts.conf</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42281653226105-1">1</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42281653226105-1">
                <span class="crayon-k ">Include</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-m">private</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">etc</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">apache2</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">extra</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">httpd</span><br />
                <span class="crayon-o">&#8211;</span><br />
                <span class="crayon-i">vhosts</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-i">conf</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0011 seconds] --></p>
<p>Now open /private/etc/apache2/extra/httpd-vhosts.conf and add the line below under the port 80 NameVirtualHost<br />
    directive
  </p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42287944511280" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
NameVirtualHost *:443</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42287944511280-1">1</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42287944511280-1">
                <span class="crayon-i">NameVirtualHost</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">*</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-cn">443</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0004 seconds] --></p>
<p>Now you can configure a basic SSL vhost by adding the code below to the end of the file. Please note that for the<br />
    DocumentRoot you should replace it with a real path.
  </p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c4228e892234582" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
&lt;VirtualHost *:443&gt;<br />
    SSLEngine on<br />
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL<br />
    SSLCertificateFile /private/etc/apache2/ssl/server.crt<br />
    SSLCertificateKeyFile /private/etc/apache2/ssl/server.key<br />
    ServerName localhost<br />
    DocumentRoot &#8220;/some/website/directory/&#8221;<br />
&lt;/VirtualHost&gt;</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c4228e892234582-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-551e666c4228e892234582-2">2</div>
<div class="crayon-num" data-line="crayon-551e666c4228e892234582-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-551e666c4228e892234582-4">4</div>
<div class="crayon-num" data-line="crayon-551e666c4228e892234582-5">5</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-551e666c4228e892234582-6">6</div>
<div class="crayon-num" data-line="crayon-551e666c4228e892234582-7">7</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-551e666c4228e892234582-8">8</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c4228e892234582-1">
                <span class="crayon-o">&lt;</span><br />
                <span class="crayon-i">VirtualHost</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">*</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-cn">443</span><br />
                <span class="crayon-o">&gt;</span>
              </div>
<div class="crayon-line crayon-striped-line" id="crayon-551e666c4228e892234582-2">
                <span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><br />
                <span class="crayon-e">SSLEngine </span><br />
                <span class="crayon-e">on</span>
              </div>
<div class="crayon-line" id="crayon-551e666c4228e892234582-3">
                <span class="crayon-e">&nbsp;&nbsp;&nbsp;&nbsp;</span><br />
                <span class="crayon-e">SSLCipherSuite </span><br />
                <span class="crayon-cn">ALL</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">!</span><br />
                <span class="crayon-cn">ADH</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">!</span><br />
                <span class="crayon-i">EXPORT56</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-i">RC4</span><br />
                <span class="crayon-o">+</span><br />
                <span class="crayon-cn">RSA</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">+</span><br />
                <span class="crayon-cn">HIGH</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">+</span><br />
                <span class="crayon-cn">MEDIUM</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">+</span><br />
                <span class="crayon-cn">LOW</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">+</span><br />
                <span class="crayon-i">SSLv2</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">+</span><br />
                <span class="crayon-cn">EXP</span><br />
                <span class="crayon-o">:</span><br />
                <span class="crayon-o">+</span><br />
                <span class="crayon-e">eNULL</span>
              </div>
<div class="crayon-line crayon-striped-line" id="crayon-551e666c4228e892234582-4">
                <span class="crayon-e">&nbsp;&nbsp;&nbsp;&nbsp;</span><br />
                <span class="crayon-i">SSLCertificateFile</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-m">private</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">etc</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">apache2</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">ssl</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">server</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-e">crt</span>
              </div>
<div class="crayon-line" id="crayon-551e666c4228e892234582-5">
                <span class="crayon-e">&nbsp;&nbsp;&nbsp;&nbsp;</span><br />
                <span class="crayon-i">SSLCertificateKeyFile</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-m">private</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">etc</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">apache2</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">ssl</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">server</span><br />
                <span class="crayon-sy">.</span><br />
                <span class="crayon-e">key</span>
              </div>
<div class="crayon-line crayon-striped-line" id="crayon-551e666c4228e892234582-6">
                <span class="crayon-e">&nbsp;&nbsp;&nbsp;&nbsp;</span><br />
                <span class="crayon-e">ServerName </span><br />
                <span class="crayon-e">localhost</span>
              </div>
<div class="crayon-line" id="crayon-551e666c4228e892234582-7">
                <span class="crayon-e">&nbsp;&nbsp;&nbsp;&nbsp;</span><br />
                <span class="crayon-i">DocumentRoot</span><br />
                <span class="crayon-h"> </span><br />
                <span class="crayon-s">&#8220;/some/website/directory/&#8221;</span>
              </div>
<div class="crayon-line crayon-striped-line" id="crayon-551e666c4228e892234582-8">
                <span class="crayon-o">&lt;</span><br />
                <span class="crayon-o">/</span><br />
                <span class="crayon-i">VirtualHost</span><br />
                <span class="crayon-o">&gt;</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0036 seconds] --></p>
<p>&nbsp;</p>
<h2>Check the config and restart Apache</h2>
</p>
<p>  <!-- Crayon Syntax Highlighter v2.6.9 --></p>
<div id="crayon-551e666c42295998626500" class="crayon-syntax crayon-theme-twilight crayon-font-monaco crayon-os-mac print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-toolbar" data-settings=" show" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
      <span class="crayon-title"></span></p>
<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
<div class="crayon-button crayon-nums-button" title="Toggle Line Numbers">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-plain-button" title="Toggle Plain Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-expand-button" title="Expand Code">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-copy-button" title="Copy">
<div class="crayon-button-icon"></div>
</p></div>
<div class="crayon-button crayon-popup-button" title="Open Code In New Window">
<div class="crayon-button-icon"></div>
</p></div>
<p>        <span class="crayon-language">PHP</span>
      </div>
</p></div>
<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;"><br />
sudo apachectl configtest<br />
sudo apachectl restart</textarea>
    </div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="show">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-551e666c42295998626500-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-551e666c42295998626500-2">2</div>
</p></div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
<div class="crayon-line" id="crayon-551e666c42295998626500-1">
                <span class="crayon-e">sudo </span><br />
                <span class="crayon-e">apachectl </span><br />
                <span class="crayon-e">configtest</span>
              </div>
<div class="crayon-line crayon-striped-line" id="crayon-551e666c42295998626500-2">
                <span class="crayon-e">sudo </span><br />
                <span class="crayon-e">apachectl </span><br />
                <span class="crayon-i">restart</span>
              </div>
</p></div>
</td>
</tr>
</table></div>
</p></div>
<p>  <!-- [Format Time: 0.0004 seconds] --></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/apache-ssl-on-mac-osx/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Bootstrap 3 grids</title>
		<link>https://geryit.com/blog/bootstrap-3-grids/</link>
					<comments>https://geryit.com/blog/bootstrap-3-grids/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 04 Aug 2014 21:25:58 +0000</pubDate>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1431</guid>

					<description><![CDATA[Bootstrap 3 Grid Introduction by Erik Flowers &#124; August 19, 2013 After over 9 months of work, Bootstrap 3 is here. It introduces a new way of thinking on how the responsive grid works, when it is best applied, and how the styled elements within the breakpoints work as well. About a month ago, I [&#8230;]]]></description>
										<content:encoded><![CDATA[<article id="post-43803" class="hentry post publish post-1 odd author-admin has-excerpt format-standard category-all-posts category-bootstrap-series category-html-and-css">
<header class="entry-header" data-320-start="opacity:1;" data-550="opacity:0;">
<h2 class="entry-title">Bootstrap 3 Grid Introduction</h2>
<div class="author">
<div class="entry-byline">by <span class="author vcard"><a class="url fn n" rel="author" href="http://www.helloerik.com/author/admin" title="Erik Flowers">Erik Flowers</a></span> | <abbr class="published" title="Monday, August 19th, 2013, 9:38 pm">August 19, 2013</abbr></div>
</div>
</header>
<p><!-- .entry-header --></p>
<div class="entry-content">
<p>After over 9 months of work, Bootstrap 3 is here. It introduces a new way of thinking on how the responsive grid works, when it is best applied, and how the styled elements within the breakpoints work as well. About a month ago, I decided I wanted to jump onboard right away, so I built a new blog theme with it (the one you&#8217;re seeing) and learned quite a bit more than I assumed I would. That&#8217;s what this post is about, sharing what I came to realize. So here&#8217;s a little guide, tutorial, and set of some examples to get you started.</p>
<p>Bootstrap 2’s grid was very straight forward. If you were using the fixed width containers, there was a normal, large, tablet, and mobile size. The base styles were all written within the context of the &#8220;desktop&#8221; width. Mobile styles were applied after through the responsive stylesheet. Compared to v3, it was very limited in out-of-the-box mobile convenience.</p>
<p>Bootstrap 3 has been heavily publicized as being mobile first. There&#8217;s been a design movement in the last year or two for &#8220;designing&#8221; mobile first, where you take your concepts and UX and plan it from the mobile perspective first, i.e. your interactions, wireframes, mockups, etc were all designed initially for the mobile experience. Bootstrap 3 has adopted that idea and built the framework on the idea that your base CSS and html should be from a mobile perspective by default.</p>
<p><strong>Update 8/25/13:</strong> There&#8217;s been some questions around the &#8216;net about 100% width sites, &#8220;liquid&#8221; as we called it in the 90&#8242;s. I have added a section for that, <a href="#fluid">click here to jump to it</a>.</p>
<p><strong>Update 9/27/13:</strong> If you like this article, be sure to read the Part 2 about a Bootstrap Less workflow here <a href="http://www.helloerik.com/bootstrap-3-less-workflow-tutorial" target="">Bootstrap 3 Less Workflow Tutorial</a> and <a href="http://www.helloerik.com/the-subtle-magic-behind-why-the-bootstrap-3-grid-works">the Subtle Magic Behind Why the Bootstrap 3 Grid Works</a>.</p>
<h2>Mobile First CSS</h2>
<p>Great. So what does this actually *mean* if I’ve never done this before? Well, let’s just jump to a very simple example. Say you have an <code>h1</code> tag at the top of your site. You design it up and check it out in your browser &#8211; looks great. Then you shrink it down to a mobile width, and the font is way too big! Here’s the thinking behind mobile first: Bootstrap expects that the styles you applied to the <code>h1</code> are appropriate for the *mobile* widths. So if you chose your font size, padding, margin etc, at the desktop size, that will probably be way off at the mobile size.</p>
<p>Here&#8217;s an example of this:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec943675e439386611" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    h1 {<br />
                    font-size: 40px;<br />
                    margin-bottom: 20px;<br />
                    margin-left: 20px;<br />
                    }</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec943675e439386611-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec943675e439386611-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec943675e439386611-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec943675e439386611-4">4</div>
<div class="crayon-num" data-line="crayon-53dfec943675e439386611-5">5</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec943675e439386611-1"><span class="crayon-k ">h1 </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec943675e439386611-2"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">font-size</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">40px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec943675e439386611-3"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">margin-bottom</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">20px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec943675e439386611-4"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">margin-left</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">20px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec943675e439386611-5"><span class="crayon-sy">}</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0012 seconds] --></p>
<p>That is how you wanted it to look on the desktop, a nice big <code>40px</code> font. But at a mobile size, it’s too big and the padding is too large. How would you have to do it with a mobile first CSS framework? Like this:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec9436771903211649" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    h1 {<br />
                    font-size: 22px;<br />
                    margin: bottom 10px;<br />
                    @media (min-width:@screen-tablet) {<br />
                    font-size: 40px;<br />
                    margin-bottom: 20px;<br />
                    margin-left: 20px;<br />
                    }<br />
                    }</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec9436771903211649-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec9436771903211649-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec9436771903211649-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec9436771903211649-4">4</div>
<div class="crayon-num" data-line="crayon-53dfec9436771903211649-5">5</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec9436771903211649-6">6</div>
<div class="crayon-num" data-line="crayon-53dfec9436771903211649-7">7</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec9436771903211649-8">8</div>
<div class="crayon-num" data-line="crayon-53dfec9436771903211649-9">9</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec9436771903211649-1"><span class="crayon-k ">h1 </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec9436771903211649-2"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">font-size</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">22px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec9436771903211649-3"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">margin</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">bottom</span><span class="crayon-h"> </span><span class="crayon-i ">10px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec9436771903211649-4"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-n">@media (min-width:@screen-tablet) {</span></div>
<div class="crayon-line" id="crayon-53dfec9436771903211649-5"><span class="crayon-n">&nbsp;&nbsp;&nbsp;&nbsp;font-size: 40px;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec9436771903211649-6"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-e ">margin-bottom</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">20px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec9436771903211649-7"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-e ">margin-left</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">20px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec9436771903211649-8"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line" id="crayon-53dfec9436771903211649-9"><span class="crayon-sy">}</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0019 seconds] --></p>
<p>See, the actual base style is the mobile style. Anything that you wanted changed at the next larger size is encapsulated in the <code>@screen-tablet</code> media query. Our font is sized at <code>22px</code> by default, but at the desktop size it is at <code>40px</code>. And, you can see that I didn’t need a margin-left on the base style, but I did add one in on the <code>@screen-tablet</code> breakpoint size, so it only applies when you&#8217;re past that min-width.</p>
<h2>The Grid&#8217;s Basic Markup</h2>
<p>For the markup that goes into your HTML, there are big changes. There are now 4 different grid classes you can use to define your layouts. This is where if you haven&#8217;t worked with a framework like this before, or you are accustomed to Bootstrap v2, it is a new way of looking at it. There are now 4 column size class variants:</p>
<ul>
<li><code>col-xs-*</code></li>
<li><code>col-sm-*</code></li>
<li><code>col-md-*</code></li>
<li><code>col-lg-*</code></li>
</ul>
<p>Now, before you panic and think &#8220;I have to write 3-4-5 freaking styles for every class I make?!&#8221; Probably not. Most of the time, the styles work fine at all the sizes, especially at the tablet and larger sizes. It’s only when you see specific needs at the larger sizes that you have to add in the adjustments. It is a small amount of time added, but:</p>
<ol>
<li>It’s way better than the old way of having whole mobile stylesheets and a &#8220;desktop first&#8221; CSS base.</li>
<li>Once you get used to it, the flexibility and power will allay any doubts.</li>
</ol>
<p>The premise is that the grid is controlled by the viewport size via the media queries and that as the browser width gets wider, the different column class will overwrite the previous. So at the phone width, the &#8220;xs (extra small)&#8221; column is active. But if you stretch your browser out wide, then the &#8220;lg (large)&#8221; class is active and overwrites the smaller sizes. If you’re confused, hang on and keep reading. This is a whole new Bootstrap paradigm. Instead of the elastic band approach of Bootstrap 2, v3 gives you now incremental control at each breakpoint.</p>
<p>Useful right? No? Don’t know? Let’s keep going!</p>
<h2>Example 1 &#8211; Basic Single Columns</h2>
<p>I am going to try and make these explanations as dead simple as possible. You have 2 divs you want to be each 50% of the total container</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec943677d126857256" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;&#8221;&gt;I’m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;&#8221;&gt;I’m on the right&lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec943677d126857256-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec943677d126857256-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec943677d126857256-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec943677d126857256-2"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0007 seconds] --></p>
<p>Now, in Bootstrap 2, we would have used the class <code>.span6</code> for both. This would have given us the 50%/50% split at the tablet and up sizes, and then it would snap to the 100% width columns at the mobile breakpoint. Not so in Bootstrap 3. Since this is a mobile first framework, all of the base columns are assumed to be 100% width, stacked vertically. Huh? So in the example above, if you wanted these 2 divs to be 50%/50%, you would FIRST have to decide at which breakpoints. If you say &#8220;I want them to be 50%/50% down to the desktop size, but not tablet or phone&#8221;, it would be written like this:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec9436788912282732" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;col-md-6&#8243;&gt;I&#8217;m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;col-md-6&#8243;&gt;I&#8217;m on the right&lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec9436788912282732-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec9436788912282732-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec9436788912282732-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-md-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I&#8217;m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec9436788912282732-2"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-md-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I&#8217;m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0007 seconds] --></p>
<p>This says &#8220;Make me a 6 column at the medium size and up.&#8221; Anything smaller than medium, it goes back to the 100% width stacked layout. This is mobile first, everything assumes that you are designing for a mobile, extra small viewport. So, let’s say you want it to be a 50%/50% split all the way down to the smallest phone width, no matter what. You use a different class for that, one that says &#8220;keep me as a 50% column all the way down to the phone size.&#8221;  You would use the new &#8220;xs&#8221; extra small class:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec943678f256862468" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;col-xs-6&#8243;&gt;I’m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;col-xs-6&#8243;&gt;I’m on the right&lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec943678f256862468-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec943678f256862468-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec943678f256862468-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-xs-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec943678f256862468-2"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-xs-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0011 seconds] --></p>
<p>This basically says &#8220;keep me at a 6 column width all the way down to the phone size, don&#8217;t ever switch me to the stacked mobile layout.&#8221; That means on a phone, it will still be a 50%/50% split on the columns since you used the specific <code>col-xs-6</code> class. To take it the other direction, say you want to have the same divs be 50%/50% at the largest snapping point, and ONLY at that point. It’s just as easy:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec9436797767701344" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;col-lg-6&#8243;&gt;I’m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;col-lg-6&#8243;&gt;I’m on the right&lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec9436797767701344-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec9436797767701344-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec9436797767701344-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-lg-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec9436797767701344-2"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-lg-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0007 seconds] --></p>
<p>That tells it to apply the &#8220;6 column&#8221; size at only the large size and up. As soon as you hit the break point going narrower, it will again assume that it’s a mobile design and take it to 100% width. I have made examples pages for this post, so Example 1 is demonstrating this most basic concept.</p>
<p><a class="examples" href="/column-examples/example1.html" target="_blank"> <button class="btn btn-primary">See Example 1</button> </a></p>
<h2>Mixed Width Columns</h2>
<p>Now we have seen the basics of how the html markup classes work. But lets go deeper. Let’s use our 2 divs again and let’s give them the 50%/50% split at the medium viewport width:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec943679e658970582" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;col-md-6&#8243;&gt;I’m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;col-md-6&#8243;&gt;I’m on the right&lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec943679e658970582-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec943679e658970582-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec943679e658970582-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-md-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec943679e658970582-2"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-md-6&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0007 seconds] --></p>
<p>Now, here’s where it&#8217;s new. Let’s say that you want it 50/50 at medium, but at large your design could really be better as a 33%/66%. So what we’re going to do is set it up to change the column widths at the breakpoint:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367a5781527031" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;col-md-6 col-lg-4&#8243;&gt;I’m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;col-md-6 col-lg-8&#8243;&gt;I’m on the right&lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367a5781527031-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367a5781527031-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367a5781527031-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-md-6 col-lg-4&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367a5781527031-2"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-md-6 col-lg-8&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0009 seconds] --></p>
<p>Does that make sense? Bootstrap is going to say &#8220;at the medium size, I look at classes with &#8216;md&#8217; in them and use those. At the large size, I look at classes with the word &#8216;lg&#8217; in them and use those.&#8221; In this case, our 2 divs will go from a 50%/50% split and then up to a 33%/66%. Just like that. This can be taken to another level, where we want to change it for the extra small phone size as well. Say we want to add the option for the columns to be split 25%/75% for tablets, we go like this:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367af122916365" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;col-sm-3 col-md-6 col-lg-4&#8243;&gt;I’m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;col-sm-9 col-md-6 col-lg-8&#8243;&gt;I’m on the right&lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367af122916365-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367af122916365-2">2</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367af122916365-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-sm-3 col-md-6 col-lg-4&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367af122916365-2"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;col-sm-9 col-md-6 col-lg-8&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I’m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0008 seconds] --></p>
<p>Now this gives us 3 different column layouts at each point. On a phone, it will be 25% on the left, and 75% on the right. On a tablet, it will be 50%/50% again, and on a large viewport, it will be 33%/66%. 3 different layouts for each of the 3 responsive sizes! Check it out in example 2:</p>
<p><a class="examples" href="/column-examples/example2.html" target="_blank"> <button class="btn btn-primary">See Example 2</button> </a></p>
<p>But, I know what some of you are thinking; that’s a lot of markup in your HTML, you could possibly use up to 4 different classes just for the grid. Some people mind that, some don’t. But there’s an answer to that too: mixins.</p>
<h2>Mixin</h2>
<p>Bootstrap 2 was set up to create columns from mixins, and v3 takes it even further. You can create your rows and columns purely from mixins and leave any grid markup out of your HTML. There are 2 basic mixin types for creating the grid:</p>
<ul>
<li><code>.make-row();</code></li>
<li><code>.make-xs/sm/md/lg-column();</code></li>
</ul>
<p>You use these mixins inside of elements that you want to serve those purposes. Here&#8217;s an example where I have a single div <code>left-and-right</code> that I want to be the row, and then <code>left</code> and <code>right</code> to be the columns inside:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367b8002540643" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    &lt;div class=&#8221;left-and-right&#8221;&gt;<br />
                    &lt;div class=&#8221;left&#8221;&gt;I&#8217;m on the left&lt;/div&gt;<br />
                    &lt;div class=&#8221;right&#8221;&gt;I&#8217;m on the right&lt;/div&gt;<br />
                    &lt;/div&gt;</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367b8002540643-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367b8002540643-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec94367b8002540643-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367b8002540643-4">4</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367b8002540643-1"><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;left-and-right&#8221;</span><span class="crayon-r ">&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367b8002540643-2"><span class="crayon-i ">&nbsp;&nbsp;</span><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;left&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I&#8217;m on the left</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line" id="crayon-53dfec94367b8002540643-3"><span class="crayon-i ">&nbsp;&nbsp;</span><span class="crayon-r ">&lt;div </span><span class="crayon-e ">class</span><span class="crayon-o">=</span><span class="crayon-s ">&#8220;right&#8221;</span><span class="crayon-r ">&gt;</span><span class="crayon-i ">I&#8217;m on the right</span><span class="crayon-r ">&lt;/div&gt;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367b8002540643-4"><span class="crayon-r ">&lt;/div&gt;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0013 seconds] --></p>
<p>Without grid column classes, these divs will just assume the default behavior of block level elements. Since we want to use the grid, but don&#8217;t want to use any markup, we&#8217;ll create the row and columns using mixins, (using Less, of course). Using the HTML above, a block of Less could look like this:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367bf092242351" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    .left-and-right {<br />
                    .make-row();<br />
                    .left {<br />
                    .make-md-column(6);<br />
                    }<br />
                    .right {<br />
                    .make-md-column(6);<br />
                    }<br />
                    }</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367bf092242351-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367bf092242351-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec94367bf092242351-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367bf092242351-4">4</div>
<div class="crayon-num" data-line="crayon-53dfec94367bf092242351-5">5</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367bf092242351-6">6</div>
<div class="crayon-num" data-line="crayon-53dfec94367bf092242351-7">7</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367bf092242351-8">8</div>
<div class="crayon-num" data-line="crayon-53dfec94367bf092242351-9">9</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367bf092242351-1"><span class="crayon-k ">.left-and-right </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367bf092242351-2"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-i ">.make-row</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367bf092242351-3"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-k ">.left </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367bf092242351-4"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-md-column</span><span class="crayon-sy">(</span><span class="crayon-i ">6</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367bf092242351-5"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367bf092242351-6"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-k ">.right </span><span class="crayon-sy">{</span></div>
<div class="crayon-line" id="crayon-53dfec94367bf092242351-7"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-md-column</span><span class="crayon-sy">(</span><span class="crayon-i ">6</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367bf092242351-8"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line" id="crayon-53dfec94367bf092242351-9"><span class="crayon-sy">}</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0014 seconds] --></p>
<p>That will add to those classes the properties of the <code>col-md-6</code> that would go in the HTML otherwise. Using the mixins, you don&#8217;t have to include any markup in the HTML.</p>
<p>Going back to example 2 of multiple, different breakpoints on an element, you can do that with the mixins too. Once you know how you want the layout at each responsive size, you just add the column mixins within each media query. Here&#8217;s an example with mixins for all 4 layout sizes:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367c7055388387" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    .left-and-right {<br />
                    .make-row();<br />
                    .left {<br />
                    .make-sm-column(1);<br />
                    .make-md-column(7);<br />
                    .make-lg-column(4);<br />
                    }<br />
                    .right {<br />
                    .make-sm-column(11);<br />
                    .make-md-column(5);<br />
                    .make-lg-column(8);<br />
                    }<br />
                    }</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367c7055388387-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367c7055388387-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec94367c7055388387-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367c7055388387-4">4</div>
<div class="crayon-num" data-line="crayon-53dfec94367c7055388387-5">5</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367c7055388387-6">6</div>
<div class="crayon-num" data-line="crayon-53dfec94367c7055388387-7">7</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367c7055388387-8">8</div>
<div class="crayon-num" data-line="crayon-53dfec94367c7055388387-9">9</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367c7055388387-10">10</div>
<div class="crayon-num" data-line="crayon-53dfec94367c7055388387-11">11</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367c7055388387-12">12</div>
<div class="crayon-num" data-line="crayon-53dfec94367c7055388387-13">13</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367c7055388387-1"><span class="crayon-k ">.left-and-right </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367c7055388387-2"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-i ">.make-row</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367c7055388387-3"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-k ">.left </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367c7055388387-4"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-sm-column</span><span class="crayon-sy">(</span><span class="crayon-i ">1</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367c7055388387-5"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-md-column</span><span class="crayon-sy">(</span><span class="crayon-i ">7</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367c7055388387-6"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-lg-column</span><span class="crayon-sy">(</span><span class="crayon-i ">4</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367c7055388387-7"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367c7055388387-8"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-k ">.right </span><span class="crayon-sy">{</span></div>
<div class="crayon-line" id="crayon-53dfec94367c7055388387-9"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-sm-column</span><span class="crayon-sy">(</span><span class="crayon-i ">11</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367c7055388387-10"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-md-column</span><span class="crayon-sy">(</span><span class="crayon-i ">5</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367c7055388387-11"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-i ">.make-lg-column</span><span class="crayon-sy">(</span><span class="crayon-i ">8</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367c7055388387-12"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line" id="crayon-53dfec94367c7055388387-13"><span class="crayon-sy">}</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0021 seconds] --></p>
<p>This changes the column widths of <code>.left</code> and <code>.right</code> at each layout. In this wacky example, the side by side <code>.left</code> and <code>.right</code> would be jumping around pretty drastically, but the effect is clearly visible here in example three:</p>
<p><a class="examples" href="/column-examples/example3.html" target="_blank"> <button class="btn btn-primary">See Example 3</button> </a></p>
<h2>Pull/Push/offset</h2>
<p>In both the HTML class and mixin method, offsets and pull/push work in the same way. You can include them as classes right in the markup, or dynamically include them as mixins. One difference between using the HTML markup and the mixins is that if you use the HTML method, at the tablet width the offsets are disabled and don&#8217;t change the layout in any way. If you want offsets to be in effect at tablets widths, you can include them as mixins. I am not quite sure why there is this difference, but there is.</p>
<p>With the pull/push abilities, you can easily flip where columns are positioned, moving them left or right at different breakpoints, which also can let them move up/down on full mobile view. It adds a lot of possibilities on top of an already powerful grid system.</p>
<p><a name="fluid"></a></p>
<h2>Update: Full Width Fluid Containers</h2>
<p>If you want to have a site that is the full width of the browser at all times, and &#8220;fluid&#8221;, you will have to make your own container class. It&#8217;s very easy. Since Bootstrap 3 is mobile first, the default state is the single column mobile width. So if you want everything bigger to function as just 1 responsive &#8220;100% fluid&#8221; width, you make a new container class and wrap your rows in it. Here&#8217;s an example:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367d0084499326" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    .my-fluid-container {<br />
                    padding-left: 15px;<br />
                    padding-right: 15px;<br />
                    margin-left: auto;<br />
                    margin-right: auto;<br />
                    }</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367d0084499326-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367d0084499326-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec94367d0084499326-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367d0084499326-4">4</div>
<div class="crayon-num" data-line="crayon-53dfec94367d0084499326-5">5</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367d0084499326-6">6</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367d0084499326-1"><span class="crayon-k ">.my-fluid-container </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367d0084499326-2"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">padding-left</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">15px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367d0084499326-3"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">padding-right</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">15px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367d0084499326-4"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">margin-left</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">auto</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367d0084499326-5"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-e ">margin-right</span><span class="crayon-sy">:</span><span class="crayon-h"> </span><span class="crayon-i ">auto</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367d0084499326-6"><span class="crayon-sy">}</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0012 seconds] --></p>
<p>That should do it. I haven&#8217;t done extensive testing on this, but from the testing I did it does seem to work. All this does is take Bootstrap&#8217;s looking for <code>.container</code> and remove the media queries that set the widths. If you want to see it, it is at the bottom of Bootstrap&#8217;s <code>variables.less</code>:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367da086702220" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    // Container sizes<br />
                    // &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>                    // Small screen / tablet<br />
                    @container-tablet:            ((720px + @grid-gutter-width));</p>
<p>                    // Medium screen / desktop<br />
                    @container-desktop:           ((940px + @grid-gutter-width));</p>
<p>                    // Large screen / wide desktop<br />
                    @container-lg-desktop:        ((1140px + @grid-gutter-width));</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367da086702220-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367da086702220-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec94367da086702220-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367da086702220-4">4</div>
<div class="crayon-num" data-line="crayon-53dfec94367da086702220-5">5</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367da086702220-6">6</div>
<div class="crayon-num" data-line="crayon-53dfec94367da086702220-7">7</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367da086702220-8">8</div>
<div class="crayon-num" data-line="crayon-53dfec94367da086702220-9">9</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367da086702220-10">10</div>
<div class="crayon-num" data-line="crayon-53dfec94367da086702220-11">11</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367da086702220-1"><span class="crayon-i ">//</span><span class="crayon-h"> </span><span class="crayon-i ">Container</span><span class="crayon-h"> </span><span class="crayon-i ">sizes</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367da086702220-2"><span class="crayon-i ">//</span><span class="crayon-h"> </span><span class="crayon-i ">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></div>
<div class="crayon-line" id="crayon-53dfec94367da086702220-3">&nbsp;</div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367da086702220-4"><span class="crayon-i ">//</span><span class="crayon-h"> </span><span class="crayon-i ">Small</span><span class="crayon-h"> </span><span class="crayon-i ">screen</span><span class="crayon-h"> </span><span class="crayon-i ">/</span><span class="crayon-h"> </span><span class="crayon-i ">tablet</span></div>
<div class="crayon-line" id="crayon-53dfec94367da086702220-5"><span class="crayon-v">@container-tablet</span><span class="crayon-sy">:</span><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">(</span><span class="crayon-sy">(</span><span class="crayon-i ">720px</span><span class="crayon-h"> </span><span class="crayon-i ">+</span><span class="crayon-h"> </span><span class="crayon-v">@grid-gutter-width</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367da086702220-6">&nbsp;</div>
<div class="crayon-line" id="crayon-53dfec94367da086702220-7"><span class="crayon-i ">//</span><span class="crayon-h"> </span><span class="crayon-i ">Medium</span><span class="crayon-h"> </span><span class="crayon-i ">screen</span><span class="crayon-h"> </span><span class="crayon-i ">/</span><span class="crayon-h"> </span><span class="crayon-i ">desktop</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367da086702220-8"><span class="crayon-v">@container-desktop</span><span class="crayon-sy">:</span><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="crayon-sy">(</span><span class="crayon-sy">(</span><span class="crayon-i ">940px</span><span class="crayon-h"> </span><span class="crayon-i ">+</span><span class="crayon-h"> </span><span class="crayon-v">@grid-gutter-width</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367da086702220-9">&nbsp;</div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367da086702220-10"><span class="crayon-i ">//</span><span class="crayon-h"> </span><span class="crayon-i ">Large</span><span class="crayon-h"> </span><span class="crayon-i ">screen</span><span class="crayon-h"> </span><span class="crayon-i ">/</span><span class="crayon-h"> </span><span class="crayon-i ">wide</span><span class="crayon-h"> </span><span class="crayon-i ">desktop</span></div>
<div class="crayon-line" id="crayon-53dfec94367da086702220-11"><span class="crayon-v">@container-lg-desktop</span><span class="crayon-sy">:</span><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">(</span><span class="crayon-sy">(</span><span class="crayon-i ">1140px</span><span class="crayon-h"> </span><span class="crayon-i ">+</span><span class="crayon-h"> </span><span class="crayon-v">@grid-gutter-width</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0031 seconds] --></p>
<p>What you&#8217;re doing is just removing those set pixel values. And by adding back in the padding, you make sure that nothing touches the edges. The narrowest mobile size doesn&#8217;t need a fixed width since it&#8217;s always 100%, so you don&#8217;t have to set anything special for that.</p>
<p>There are some other techniques for putting fixed/responsive containers inside of liquid containers, and maybe I&#8217;ll come back to that if people care. Typically this comes into play if you&#8217;re doing something where you want a fixed-width sidebar for a nav or something, and then the rest of the right-side of the browser is fluid. This isn&#8217;t really a Bootstrap thing though, as much as it is putting Bootstrap inside of an outer scaffolding. I&#8217;ve done it before, and it&#8217;s cool, just takes some reworking of how Bootstrap sees the media query snap points, since it&#8217;s looking for viewport widths, but you&#8217;ve added things that push Bootstrap in either direction, so you have to account for that and add it to the media query&#8230; (this is another blog post topic).</p>
<p>Be warned &#8211; the various column sizes will still respond to the viewport width on when they change to the mobile view. You&#8217;ll have to decide how you want to do that. If you just want it to be simple and liquid, just use <code>.col-sm-*</code> for everything. Check it out in Example 4:</p>
<p><a class="examples" href="/column-examples/example4.html" target="_blank"> <button class="btn btn-primary">See Example 4</button> </a></p>
<p>If you encounter any weirdness with this, post in the comments below.</p>
<h2>Using Both Responsive Class Attributes and Mixin Columns</h2>
<p>Taking everything we&#8217;ve learned so far, we can leverage both the CSS responsive attributes and the column mixins to basically do anything we want. This is closer to how an exaggerated real world implementation might look:</p>
<p><!-- Crayon Syntax Highlighter v2.6.5 --></p>
<div id="crayon-53dfec94367e4804111406" class="crayon-syntax crayon-theme-familiar crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:2; -o-tab-size:2; -webkit-tab-size:2; tab-size:2; font-size: 12px !important; line-height: 15px !important;"><br />
                    .main-content {<br />
                    .make-row();<br />
                    .sidebar {<br />
                    padding: 20px;<br />
                    @media(min-width: @screen-desktop) {<br />
                    padding: 30px;<br />
                    }<br />
                    h2 {<br />
                    font-size: 20px;<br />
                    @media(min-width: @screen-desktop) {<br />
                    font-size: 30px<br />
                    }<br />
                    }<br />
                    .make-sm-column(2);<br />
                    .make-md-column(3);<br />
                    }<br />
                    .content-area {<br />
                    line-height: 1.2em;<br />
                    @media(min-width: @screen-desktop) {<br />
                    line-height: 1.6em;<br />
                    }<br />
                    h1 {<br />
                    font-size: 30px;<br />
                    @media(min-width: @screen-desktop) {<br />
                    font-size: 40px;<br />
                    }<br />
                    }<br />
                    .make-sm-column(10);<br />
                    .make-md-column(9);<br />
                    }<br />
                    }</textarea></div>
<div class="crayon-main" style="">
<table class="crayon-table">
<tr class="crayon-row">
<td class="crayon-nums " data-settings="hide">
<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-1">1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-2">2</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-3">3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-4">4</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-5">5</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-6">6</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-7">7</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-8">8</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-9">9</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-10">10</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-11">11</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-12">12</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-13">13</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-14">14</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-15">15</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-16">16</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-17">17</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-18">18</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-19">19</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-20">20</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-21">21</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-22">22</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-23">23</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-24">24</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-25">25</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-26">26</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-27">27</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-28">28</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-29">29</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-53dfec94367e4804111406-30">30</div>
<div class="crayon-num" data-line="crayon-53dfec94367e4804111406-31">31</div>
</div>
</td>
<td class="crayon-code">
<div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important;">
<div class="crayon-line" id="crayon-53dfec94367e4804111406-1"><span class="crayon-sy">.</span><span class="crayon-v">main</span><span class="crayon-o">&#8211;</span><span class="crayon-e">content</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-2"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">.</span><span class="crayon-v">make</span><span class="crayon-o">&#8211;</span><span class="crayon-e">row</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-3"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">.</span><span class="crayon-i">sidebar</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-4"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">padding</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">20px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-5"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">@</span><span class="crayon-e">media</span><span class="crayon-sy">(</span><span class="crayon-v">min</span><span class="crayon-o">&#8211;</span><span class="crayon-v">width</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-sy">@</span><span class="crayon-v">screen</span><span class="crayon-o">&#8211;</span><span class="crayon-v">desktop</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-6"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">padding</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">30px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-7"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-8"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-e">h2</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-9"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">font</span><span class="crayon-o">&#8211;</span><span class="crayon-v">size</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">20px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-10"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">@</span><span class="crayon-e">media</span><span class="crayon-sy">(</span><span class="crayon-v">min</span><span class="crayon-o">&#8211;</span><span class="crayon-v">width</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-sy">@</span><span class="crayon-v">screen</span><span class="crayon-o">&#8211;</span><span class="crayon-v">desktop</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-11"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">font</span><span class="crayon-o">&#8211;</span><span class="crayon-v">size</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">30px</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-12"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-13"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-14"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">.</span><span class="crayon-v">make</span><span class="crayon-o">&#8211;</span><span class="crayon-v">sm</span><span class="crayon-o">&#8211;</span><span class="crayon-e">column</span><span class="crayon-sy">(</span><span class="crayon-cn">2</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-15"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">.</span><span class="crayon-v">make</span><span class="crayon-o">&#8211;</span><span class="crayon-v">md</span><span class="crayon-o">&#8211;</span><span class="crayon-e">column</span><span class="crayon-sy">(</span><span class="crayon-cn">3</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-16"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-17"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">.</span><span class="crayon-v">content</span><span class="crayon-o">&#8211;</span><span class="crayon-e">area</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-18"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">line</span><span class="crayon-o">&#8211;</span><span class="crayon-v">height</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">1.2em</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-19"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">@</span><span class="crayon-e">media</span><span class="crayon-sy">(</span><span class="crayon-v">min</span><span class="crayon-o">&#8211;</span><span class="crayon-v">width</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-sy">@</span><span class="crayon-v">screen</span><span class="crayon-o">&#8211;</span><span class="crayon-v">desktop</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-20"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">line</span><span class="crayon-o">&#8211;</span><span class="crayon-v">height</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">1.6em</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-21"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-22"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-e">h1</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-23"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">font</span><span class="crayon-o">&#8211;</span><span class="crayon-v">size</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">30px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-24"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">@</span><span class="crayon-e">media</span><span class="crayon-sy">(</span><span class="crayon-v">min</span><span class="crayon-o">&#8211;</span><span class="crayon-v">width</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-sy">@</span><span class="crayon-v">screen</span><span class="crayon-o">&#8211;</span><span class="crayon-v">desktop</span><span class="crayon-sy">)</span><span class="crayon-h"> </span><span class="crayon-sy">{</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-25"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-v">font</span><span class="crayon-o">&#8211;</span><span class="crayon-v">size</span><span class="crayon-o">:</span><span class="crayon-h"> </span><span class="crayon-cn">40px</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-26"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-27"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-28"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">.</span><span class="crayon-v">make</span><span class="crayon-o">&#8211;</span><span class="crayon-v">sm</span><span class="crayon-o">&#8211;</span><span class="crayon-e">column</span><span class="crayon-sy">(</span><span class="crayon-cn">10</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-29"><span class="crayon-h">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="crayon-sy">.</span><span class="crayon-v">make</span><span class="crayon-o">&#8211;</span><span class="crayon-v">md</span><span class="crayon-o">&#8211;</span><span class="crayon-e">column</span><span class="crayon-sy">(</span><span class="crayon-cn">9</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-53dfec94367e4804111406-30"><span class="crayon-h">&nbsp;&nbsp;</span><span class="crayon-sy">}</span></div>
<div class="crayon-line" id="crayon-53dfec94367e4804111406-31"><span class="crayon-sy">}</span></div>
</div>
</td>
</tr>
</table></div>
</p></div>
<p>        <!-- [Format Time: 0.0090 seconds] --></p>
<p>This essentially would let you have an entirely different layout at each responsive width, both in the grid and the styles altogether, and it&#8217;s not that much work to write in the Less. And as a bonus, by using the column mixins you don&#8217;t need to change anything in your HTML if you&#8217;ve already got it how you want it.</p>
<p>One of the things you have to get used to remembering is that the styles now cascade &#8220;up and out&#8221; from the base mobile CSS. Even though you can just design for the desktop view like normal, you will then have to basically &#8220;port up&#8221; the CSS from mobile widths and move the desktop styles into the right media query, and then fix/replace the styles at the base level. This isn&#8217;t a problem if you don&#8217;t care about how perfect things are at mobile widths. If you do want your site to be a great mobile experience, keep 2 browser windows open &#8211; one at the desktop width, and one at mobile. That way you can at least see when something is terribly out of place in either view.</p>
<h2>Give em&#8217; the boot!</h2>
<p>Bootstrap 3 moves the whole paradigm of mobile first CSS forward, and makes it more accessible to the people who may have never done mobile first before. It&#8217;s more dynamic, flexible, and in the end I think will be easier to use.</p>
<p>All in all, I am very excited to use Bootstrap 3. I was a huge fan of v2, and v3 is such a step forward it&#8217;s hard not to marvel at the work that the <a href="http://www.twitter.com/twbootstrap" target="_blank">@twbootstrap</a> guys (<a href="http://www.twitter.com/mdo" target="_blank">@md0</a>, <a href="http://www.twitter.com/fat" target="_blank">@fat</a>) and Github contributors have put into this.</p>
<p>Go <a href="https://github.com/twbs/bootstrap" target="_blank">get Bootstrap</a> now and give it a try! If you have any comments, questions, want some help, have ideas or anything else, post in the Disqus thread below.</p>
<p>Like this article? Read the Part 2 about a Bootstrap Less workflow here <a href="http://www.helloerik.com/bootstrap-3-less-workflow-tutorial" target="">Bootstrap 3 Less Workflow Tutorial</a> and  <a href="http://www.helloerik.com/the-subtle-magic-behind-why-the-bootstrap-3-grid-works">the Subtle Magic Behind Why the Bootstrap 3 Grid Works</a>.</p>
<p>Examples: <a class="examples" href="/column-examples/example1.html" target="_blank"> <button class="btn btn-primary">See Example 1</button> </a> <a class="examples" href="/column-examples/example2.html" target="_blank"> <button class="btn btn-primary">See Example 2</button> </a> <a class="examples" href="/column-examples/example3.html" target="_blank"> <button class="btn btn-primary">See Example 3</button> </a> <a class="examples" href="/column-examples/example4.html" target="_blank"> <button class="btn btn-primary">See Example 4</button> </a></p>
<p><em>(As updates are made to Bootstrap 3, or my examples need refining, I&#8217;ll be updating this article and noting where I&#8217;ve done so)</em></p>
<p>&nbsp;</p>
<p><em>Update 8/25/13: Added a section on making a 100% liquid container <a href="#fluid">here</a>.<br />
            </em></p>
</p></div>
<p><!-- .entry-content --></p>
<p>    <!-- .entry-footer --></p>
<div class="post-separator"></div>
</article>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/bootstrap-3-grids/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sticky / Persistent Headers</title>
		<link>https://geryit.com/blog/sticky-persistent-headers/</link>
					<comments>https://geryit.com/blog/sticky-persistent-headers/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 15 Jun 2013 14:37:42 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jquery]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1412</guid>

					<description><![CDATA[I needed a &#8220;sticky headers&#8221; plugin for a project Im working on and found some samples like this one, unfortunately, it doesnt work on Webkit browsers, so here is what I came with: &#60;div class=&#34;sticky-list&#34;&#62; &#60;ul class=&#34;sticky-ul&#34;&#62; &#60;li&#62; &#60;h3 class=&#34;title&#34;&#62;Section Headline 0&#60;/h3&#62; &#60;ul&#62; &#60;li&#62;Content line 0&#60;/li&#62; &#60;li&#62;Content line 1&#60;/li&#62; &#60;li&#62;Content line 2&#60;/li&#62; &#60;li&#62;Content line 3&#60;/li&#62; [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I needed a &#8220;sticky headers&#8221; plugin for a project Im working on and found some samples like <a href="http://polarblau.github.io/stickySectionHeaders/">this one</a>, unfortunately, it doesnt work on Webkit browsers, so here is what I came with:<br />
<iframe loading="lazy" width="100%" height="300" src="http://jsfiddle.net/goksel/UKeuV/embedded/result,js/" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<pre class="brush: html">
&lt;div class=&quot;sticky-list&quot;&gt;
        &lt;ul class=&quot;sticky-ul&quot;&gt;
            &lt;li&gt;
                 &lt;h3 class=&quot;title&quot;&gt;Section Headline 0&lt;/h3&gt;

                &lt;ul&gt;
                    &lt;li&gt;Content line 0&lt;/li&gt;
                    &lt;li&gt;Content line 1&lt;/li&gt;
                    &lt;li&gt;Content line 2&lt;/li&gt;
                    &lt;li&gt;Content line 3&lt;/li&gt;
                    &lt;li&gt;Content line 4&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;
                 &lt;h3 class=&quot;title&quot;&gt;Section Headline 1&lt;/h3&gt;

                &lt;ul&gt;
                    &lt;li&gt;Content line 0&lt;/li&gt;
                    &lt;li&gt;Content line 1&lt;/li&gt;
                    &lt;li&gt;Content line 2&lt;/li&gt;
                    &lt;li&gt;Content line 3&lt;/li&gt;
                    &lt;li&gt;Content line 4&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;
                 &lt;h3 class=&quot;title&quot;&gt;Section Headline 2&lt;/h3&gt;

                &lt;ul&gt;
                    &lt;li&gt;Content line 0&lt;/li&gt;
                    &lt;li&gt;Content line 1&lt;/li&gt;
                    &lt;li&gt;Content line 2&lt;/li&gt;
                    &lt;li&gt;Content line 3&lt;/li&gt;
                    &lt;li&gt;Content line 4&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;
                 &lt;h3 class=&quot;title&quot;&gt;Section Headline 3&lt;/h3&gt;

                &lt;ul&gt;
                    &lt;li&gt;Content line 0&lt;/li&gt;
                    &lt;li&gt;Content line 1&lt;/li&gt;
                    &lt;li&gt;Content line 2&lt;/li&gt;
                    &lt;li&gt;Content line 3&lt;/li&gt;
                    &lt;li&gt;Content line 4&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
</pre>
<pre class="brush: css">ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
h3 {
    background: #fff;
    margin: 0;
}
.sticky-list {
    height: 160px;
    position: relative;
    overflow: hidden;
    width: 200px;
    margin: 20px auto;
}
.sticky-ul {
    height: 100%;
    overflow: auto;
    padding-top: 20px;
}
.sticky {
    position: absolute;
    top: 0;
}</pre>
<pre class="brush: js">$(".sticky-ul").each(function () {
    var cname = "sticky";
    var v = $(".title");
    var h = v.outerHeight();
    v.eq(0).addClass(cname);
    $(this).scroll(function () {
        v.each(function () {
            var t = this;

            var top_of_container = $(t).scrollTop();
            var top_of_object = $(t).position().top;


            if (top_of_container > top_of_object) {
                v.removeClass(cname).css("top", "auto");
                $(t).addClass(cname).css("top", 0);
            } else if ((top_of_container > top_of_object - h) && top_of_container - top_of_object < 0) {
                $("." + cname).css("top", top_of_object - top_of_container - h + "px")

            }


        });


    });
});</pre>
<p><a href="http://jsfiddle.net/goksel/UKeuV/">DEMO</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/sticky-persistent-headers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Creating a simple jQuery plugin for Pinterest</title>
		<link>https://geryit.com/blog/creating-a-simple-jquery-plugin-for-pinterest/</link>
					<comments>https://geryit.com/blog/creating-a-simple-jquery-plugin-for-pinterest/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 11 May 2013 13:47:36 +0000</pubDate>
				<category><![CDATA[Jquery]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1405</guid>

					<description><![CDATA[Introduction Plugins play a great part in the success of jQuery. There are hundreds of them out there, and having the ability to create your own is a great skill to have. With all of the interest in Pinterest (no pun intended), I thought it would be a good idea to do up a quick [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="entry-content se-content">
<h2>Introduction</h2>
<p class="single-first-p">Plugins play a great part in the success of jQuery. There are hundreds of them out there, and having the ability to create your own is a great skill to have. With all of the interest in <a href="http://pinterest.com/" target="_blank">Pinterest</a> (no pun intended), I thought it would be a good idea to do up a quick and simple Pinterest sharing plugin for jQuery.</p>
<h2>Getting started</h2>
<p>First we need to grab the jQuery plugin <a href="http://docs.jquery.com/Plugins/Authoring" target="_blank">boilerplate</a></p>
<pre class="brush: js">                                            (function( $ ) {
                                            $.fn.pinterest = function(options) {

                                            var settings = $.extend( {
                                            }, options);

                                            return this.each(function() {

                                            });

                                            };
                                            })( jQuery );</pre>
<p>This boilerplate provides us with the ability to specify default configuration values (settings) and ensures that the infamous jQuery chaining ability is maintained (the return this.each). I’m going to take advantage of the default configuration values by specifying the default Pinterest image we’ll be using. This can be overridden when initializing the plugin by specifying the url to the preferred image.</p>
<h3>Default image</h3>
<p><img decoding="async" loading="lazy" class="alignnone" alt="" src="http://business.pinterest.com/assets/img/builder/builder_opt_1.png" width="40" height="20" /></p>
<h3>Custom image</h3>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4090" alt="pinterest-alt" src="http://developerdrive.developerdrive.netdna-cdn.com/wp-content/uploads/2013/05/pinterest-alt.png" width="52" height="25" /></p>
<pre class="brush: js">                                            (function( $ ) {
                                            $.fn.pinterest = function(options) {

                                            var settings = $.extend( {
                                            'button' : 'http://business.pinterest.com/assets/img/builder/builder_opt_1.png'
                                            }, options);

                                            return this.each(function() {

                                            });

                                            };
                                            })( jQuery );

                                            $(document).on('ready', function(){
                                            $('img#share').pinterest({ button: 'pinterest-alt.png'});
                                            });</pre>
<p>Now that we have a basic framework done, let’s start adding some functionality. We need to update the this.each function to initialize each image and add some events for us. I’ve chosen to have the icon hover over the image being shared. To do this, I need to <a href="http://docs.jquery.com/Manipulation/wrap" target="_blank">wrap</a> the image in a span element that positioned ‘relative’, I then need to <a href="http://docs.jquery.com/Manipulation/append" target="_blank">append</a> the share image and position it absolutely. I’m going with the bottom right, but feel free to have a play</p>
<pre class="brush: js">(function( $ ) {
                                            $.fn.pinterest = function(options) {

                                            var settings = $.extend( {
                                            'button' : 'http://business.pinterest.com/assets/img/builder/builder_opt_1.png'
                                            }, options);

                                            return this.each(function() {
                                            img = $(this);
                                            img.wrap('&lt;span class="pin-it" style="position: relative;" /&gt;');
                                            img.parent('span.pin-it').append('&lt;img src="' + settings.button + '" style="display: none;position: absolute; bottom: 20px; right: 20px;cursor: hand; cursor: pointer;" /&gt;');
                                            });
                                            };
                                            })( jQuery );

                                            $(document).on('ready', function(){
                                            $('img#share').pinterest({ button: 'pinterest-alt.png'});
                                            });</pre>
<p>Now that the elements that we need are there, we can start attaching our events. I’m going to use the hover and click events. When the user hovers over the main image, the share button will appear.</p>
<pre class="brush: js">                                            (function( $ ) {
                                            $.fn.pinterest = function(options) {

                                            var settings = $.extend( {
                                            'button' : 'http://business.pinterest.com/assets/img/builder/builder_opt_1.png'
                                            }, options);

                                            function on_click () {
                                            };

                                            function on_hover_in() {
                                            $(this).siblings('img:first').show(500);
                                            };

                                            return this.each(function() {
                                            img = $(this);
                                            img.wrap('&lt;span class="pin-it" style="position: relative;" /&gt;');
                                            img.parent('span.pin-it').append('&lt;img src="' + settings.button + '" style="display: none;position: absolute; bottom: 20px; right: 20px;cursor: hand; cursor: pointer;" /&gt;');
                                            img.hover(on_hover_in);
                                            img.siblings('img:first').on('click', on_click);
                                            });

                                            };
                                            })( jQuery );

                                            $(document).on('ready', function(){
                                            $('img#share').pinterest({ button: 'pinterest-small.png'});
                                            });</pre>
<p>The on_click event looks like the following</p>
<pre class="brush: js">                                            function on_click () {
                                            img = $(this).siblings('img:first');
                                            description = img.attr('title');
                                            url = document.location;
                                            media = img.attr('src');

                                            var pin_url = 'http://pinterest.com/pin/create/button/?url=' + encodeURIComponent( url ) +
                                            '&amp;media=' + encodeURIComponent( media ) +
                                            '&amp;description=' + encodeURIComponent( description );

                                            window.open(pin_url, 'Pin - ' + description, 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');
                                            $(this).hide(1000);
                                            };</pre>
<p>It’s grabbing the image we want to share, and then reading it’s title and src attributes. It’s also getting the current pages url using document.location. The Pinterest share url has 3 parameters that we are interested in:</p>
<ul>
<li>url – the page we are sharing from</li>
<li>media – the image we want to share</li>
<li>description – the text we want to share with the image</li>
</ul>
<p>When I’m creating the share url, I’m also using the JavaScript <a href="https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/encodeURIComponent" target="_blank">encodeURIComponent</a> function to make sure the values are properly escaped.</p>
<p>One final thing we need to allow for is if the image src url is relative or not. If it’s relative we’ll need to update the media url to be fully qualified.</p>
<pre class="brush: js">                                            function getUrl(src){
                                            var url = document.location.toString();
                                            var http = /^https?:\/\//i;
                                            if (!http.test(src)) {
                                            if(src[0] == '/'){
                                            url = url.substring(0, url.lastIndexOf('/')) + src;
                                            } else {
                                            url = url.substring(0, url.lastIndexOf('/')) + '/' + src;
                                            }
                                            } else {
                                            url = src;
                                            }

                                            return url;
                                            };</pre>
<p>This function is checking to see if the provided src URL starts with http or not. If it doesn’t it then creates an absolute url and returns it.</p>
<p>And that’s it, we now have a fully functional jQuery plugin for sharing images on Pinterest. You can see the full HTML and JavaScript or download it below. The image I’m sharing by the way is <a href="http://en.wikipedia.org/wiki/Three_Musicians" target="_blank">Picasso’s Three Musicians</a></p>
<pre class="brush: js">                                            &lt;!DOCTYPE html&gt;
                                            &lt;html lang="en"&gt;
                                            &lt;head&gt;
                                            &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"&gt;
                                            &lt;title&gt;Creating a simple Pinterest! jQuery&lt;/title&gt;
                                            &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
                                            &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"&gt;&lt;/script&gt;

                                            &lt;script type="text/javascript"&gt;

                                            (function( $ ) {
                                            $.fn.pinterest = function(options) {

                                            var settings = $.extend( {
                                            'button' : 'http://business.pinterest.com/assets/img/builder/builder_opt_1.png'
                                            }, options);

                                            function getUrl(src){
                                            var url = document.location.toString();
                                            var http = /^https?:\/\//i;
                                            if (!http.test(src)) {
                                            if(src[0] == '/'){
                                            url = url.substring(0, url.lastIndexOf('/')) + src;
                                            } else {
                                            url = url.substring(0, url.lastIndexOf('/')) + '/' + src;
                                            }
                                            } else {
                                            url = src;
                                            }

                                            return url;
                                            };

                                            function on_click () {
                                            img = $(this).siblings('img:first');
                                            description = img.attr('title');
                                            url = document.location;
                                            media = getUrl( img.attr('src') );

                                            var pin_url = 'http://pinterest.com/pin/create/button/?url=' + url +
                                            '&amp;media=' + media +
                                            '&amp;description=' + description;

                                            window.open(pin_url, 'Pin - ' + description, 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');
                                            $(this).hide(1000);
                                            };

                                            function on_hover_in() {
                                            $(this).siblings('img:first').show(500);
                                            };

                                            return this.each(function() {
                                            img = $(this);
                                            img.wrap('&lt;span class="pin-it" style="position: relative;" /&gt;');
                                            img.parent('span.pin-it').append('&lt;img src="' + settings.button + '" style="display: none;position: absolute; bottom: 20px; right: 20px;cursor: hand; cursor: pointer;" /&gt;');
                                            img.hover(on_hover_in);
                                            img.siblings('img:first').on('click', on_click);
                                            });

                                            };
                                            })( jQuery );
                                            &lt;/script&gt;
                                            &lt;/head&gt;
                                            &lt;body&gt;
                                            &lt;div id="page"&gt;
                                            &lt;!-- [banner] --&gt;
                                            &lt;header id="banner"&gt;
                                            &lt;hgroup&gt;
                                            &lt;h1&gt;Creating a simple Pinterest! jQuery&lt;/h1&gt;
                                            &lt;/hgroup&gt;
                                            &lt;/header&gt;
                                            &lt;!-- [content] --&gt;
                                            &lt;section id="content"&gt;
                                            &lt;img id="share" src="picasso.jpg" title="Three Musicians" /&gt;
                                            &lt;/section&gt;

                                            &lt;script&gt;
                                            $(document).on('ready', function(){
                                            $('img#share').pinterest({ button: 'pinterest-small.png'});
                                            });
                                            &lt;/script&gt;
                                            &lt;/div&gt;
                                            &lt;!-- [/page] --&gt;
                                            &lt;/body&gt;
                                            &lt;/html&gt;</pre>
<p><a href="http://developerdrive.developerdrive.netdna-cdn.com/wp-content/uploads/2013/05/index1.html" target="_blank"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3371" alt="" src="http://developerdrive.developerdrive.netdna-cdn.com/wp-content/uploads/2013/02/view-demo-button.jpg" width="232" height="60" /></a></p>
<p><a href="http://developerdrive.developerdrive.netdna-cdn.com/wp-content/uploads/2013/05/jquery-pinterest1.zip"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3629" alt="" src="http://developerdrive.developerdrive.netdna-cdn.com/wp-content/uploads/2013/03/download.jpg" width="300" height="53" /></a></p>
<div class="post-author-bio">
<div class="asection-title">ABOUT THE AUTHOR</div>
<div class="clr">
<div class="author-bio-text">A battle hardened software developer with a mixed and colorful background, who can’t come up with a decent author bio <a href="http://schnittger.me">http://schnittger.me</a></div>
<div class="clr"></div>
</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/creating-a-simple-jquery-plugin-for-pinterest/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			<enclosure length="39770" type="application/zip" url="http://developerdrive.developerdrive.netdna-cdn.com/wp-content/uploads/2013/05/jquery-pinterest1.zip"/><itunes:explicit>no</itunes:explicit><itunes:subtitle>Introduction Plugins play a great part in the success of jQuery. There are hundreds of them out there, and having the ability to create your own is a great skill to have. With all of the interest in Pinterest (no pun intended), I thought it would be a good idea to do up a quick [&amp;#8230;]</itunes:subtitle><itunes:summary>Introduction Plugins play a great part in the success of jQuery. There are hundreds of them out there, and having the ability to create your own is a great skill to have. With all of the interest in Pinterest (no pun intended), I thought it would be a good idea to do up a quick [&amp;#8230;]</itunes:summary><itunes:keywords>Jquery</itunes:keywords></item>
		<item>
		<title>Convert Old CSS To LESS</title>
		<link>https://geryit.com/blog/convert-old-css-to-less/</link>
					<comments>https://geryit.com/blog/convert-old-css-to-less/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 19 Mar 2013 18:10:55 +0000</pubDate>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Fun Stuff]]></category>
		<guid isPermaLink="false">https://geryit.com/blog/?p=1400</guid>

					<description><![CDATA[We have covered much of the basics for LESS in our previous posts. If you have been following our LESS series, we believe that at this point you already have a good idea about how to use the Variables, Mixins and Operation in LESS. We have also mentioned how to convert LESS into regular CSS, [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="sContent intxt">
                    <!-- google_ad_section_start --></p>
<p>We have covered much of the basics for LESS in our <a href="http://www.hongkiat.com/blog/tag/less-css/">previous posts</a>. If you have been following our LESS series, we believe that at this point you already have a good idea about how to use the <strong><a href="http://www.hongkiat.com/blog/less-css-tutorial-design-slick-menu-nav-bar/">Variables</a></strong><a href="http://www.hongkiat.com/blog/less-css-tutorial-design-slick-menu-nav-bar/">, <strong>Mixins</strong> and <strong>Operation</strong></a> in <a rel="external" href="http://lesscss.org/">LESS</a>.</p>
<p class="sw"><img decoding="async" loading="lazy" src="http://media02.hongkiat.com/css-to-less/css-less-cover.jpg" width="500" height="300"></p>
<p>We have also mentioned how to convert LESS into <a rel="external" href="http://www.hongkiat.com/blog/css-back-to-basics-terminology-explained/">regular CSS</a>, with an app or with a compiler. But, how do we do the opposite; to convert CSS into LESS? Well, this tip is for you.</p>
<h3>Using a Tool</h3>
<p>With increasing popularity of <strong>CSS preprocessor</strong>, some new tools and apps  that essentially aim to makea web designer&#8217;s or developer&#8217;s life easier, such as this tool: <a rel="external" href="http://css2less.cc/">CSS2Less</a>.</p>
<p>This tool allows us to convert regular CSS into LESS. So, let&#8217;s give it a try. I have the following CSS rules from my old file to be converted.</p>
<pre 11421 class="css">
                        nav {
                        height: 40px;
                        width: 100%;
                        background: #000;
                        border-bottom: 2px solid #fff;
                        }
                        nav ul {
                        padding: 0;
                        margin: 0 auto;
                        }
                        nav li {
                        display: inline;
                        float: left;
                        }
                        nav a {
                        color: #fff;
                        display: inline-block;
                        width: 100px;
                        text-shadow: 1px 1px 0px #000;
                        }
                        nav li a {
                        border-right: 1px solid #fff;
                        box-sizing:border-box;
                        }
                        nav li:last-child a {
                        border-right: 0;
                        }
                        nav a:hover, nav a:active {
                        background-color: #fff;
                        }
                    </pre>
<p>Here is the result.</p>
<p class="sw"><img decoding="async" loading="lazy" src="http://media02.hongkiat.com/css-to-less/css-less-result.jpg" width="500" height="300"></p>
<pre 11421 class="css">
                        nav a:hover, nav a:active {
                        background-color: #fff;
                        }
                        nav {
                        height: 40px;
                        width: 100%;
                        background: #000;
                        border-bottom: 2px solid #fff;
                        a {
                        color: #fff;
                        display: inline-block;
                        width: 100px;
                        text-shadow: 1px 1px 0px #000;
                        }
                        ul {
                        padding: 0;
                        margin: 0 auto;
                        }
                        li:last-child {
                        a {
                        border-right: 0;
                        }
                        }
                        li {
                        display: inline;
                        float: left;
                        a {
                        border-right: 1px solid #fff;
                        box-sizing:border-box;
                        }
                        }
                        }
                    </pre>
<p>As we can see above, our old CSS is now nested like in LESS.</p>
<h3>Limitation</h3>
<p>However we can also see some limitations in the results of the conversion. In the old CSS, we have several same colors, such as in these two declarations <code>border-bottom: 2px solid #fff;</code> and <code>border-right: 1px solid #fff;</code> we have  both borders in white. In LESS we can actually store this constant value in a <strong>Variable</strong>.</p>
<p>It also does not nest and separate the <a rel="external" href="http://www.hongkiat.com/blog/pseudo-element-before-after/"><em>pseudo-*</em></a> with an ampersand (&amp;) symbol, such as in the following rules <code>li:last-child</code> and <code>nav a:hover, nav a:active</code>. They just remain as they are, where we can actually simplify the rulesets this way;</p>
<pre 11421 class="css">
                        li {
                        &amp;:first-child {

                        }
                        a {
                        &amp;:hover {

                        }
                        &amp;:active {

                        }
                        }
                        }
                    </pre>
<h3>Conclusion</h3>
<p>Despite the limitations it currently still has, this tool can quite helpful in saving our time for nesting CSS rulesets. We only need to do the rest manually; possibly until the the limitations above are <strong>resolved</strong>.</p>
<div class="gad_wrap">
                        <script language="JavaScript">
                            function google_ad_request_done(google_ads) {
                                var s = ''; var i;
                                if (google_ads.length == 0) { return; }
                                if (google_ads.length == 1) {
                                    s += '</p>
<div class=\"gad_adFeedback\"><a href=\"'+google_info.feedback_url+'\">Ads by Google</a></div>
<div class=\"gad_unit\"><a class=\"gad_adTitle\" href=\"'+google_ads[0].url+'\" onmouseout=\"window.status=\" onmouseover=\"window.status=\'go to '+google_ads[0].visible_url+';return true\'\"><span>'+google_ads[0].line1+'</span></a><a class=\"gad_adURL\" href=\"'+google_ads[0].url+'\" onmouseout=\"window.status=\'\'\" onmouseover=\"window.status=\'go to '+google_ads[0].visible_url+';return true\'\"><span>'+google_ads[0].visible_url+'</span></a> <span class=\"gad_adText\">'+google_ads[0].line2+' '+google_ads[0].line3+'</span></div>
<p>';
                                }
                                else if (google_ads.length > 1) {
                                    s += '</p>
<div class=\"gad_adFeedback\"><a href=\"' + google_info.feedback_url + '\">Ads by Google</a></div>
<p>'
                                    for(i = 0; i < google_ads.length; ++i) {
                                        s += '

<div class=\"gad_unit\"><a class=\"gad_adTitle\" href=\"'+google_ads[i].url+'\" onmouseout=\"window.status=\" onmouseover=\"window.status=\'go to '+google_ads[i].visible_url+';return true\'\"><span>'+google_ads[i].line1+'</span></a><a class=\"gad_adURL\" href=\"'+google_ads[i].url+'\" onmouseout=\"window.status=\'\'\" onmouseover=\"window.status=\'go to '+google_ads[i].visible_url+';return true\'\"><span>'+google_ads[i].visible_url+'</span></a> <span class=\"gad_adText\">'+google_ads[i].line2+' '+google_ads[i].line3+'</span></div>
<p>';
                                    }
                                }
                                if (google_ads[0].bidtype == "CPC") {
                                    google_adnum = google_adnum + google_ads.length;
                                }
                                document.write(s);
                                return;
                            }
                            google_ad_client = 'pub-8918970543424762';
                            google_ad_channel = '0118666992';
                            google_ad_output = 'js';
                            google_max_num_ads = '2';
                            google_ad_type = 'text';
                            google_feedback = 'on';
                            google_skip = google_adnum;
                        </script><br />
                        <script language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
                    </div>
<p>                    <!-- google_ad_section_end -->
                </div>
]]></content:encoded>
					
					<wfw:commentRss>https://geryit.com/blog/convert-old-css-to-less/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>