<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shan-e-Hussain Naqvi on Medium]]></title>
        <description><![CDATA[Stories by Shan-e-Hussain Naqvi on Medium]]></description>
        <link>https://medium.com/@shanehussainnaqvi?source=rss-517beca49e3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*F_MZRSuvwExMGXVG</url>
            <title>Stories by Shan-e-Hussain Naqvi on Medium</title>
            <link>https://medium.com/@shanehussainnaqvi?source=rss-517beca49e3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 10:01:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shanehussainnaqvi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Emmet in coding to achieve a fast pace workflow]]></title>
            <link>https://medium.com/@shanehussainnaqvi/using-emmet-in-coding-to-achieve-a-fast-pace-workflow-7df0643e634d?source=rss-517beca49e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7df0643e634d</guid>
            <category><![CDATA[emmet]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Shan-e-Hussain Naqvi]]></dc:creator>
            <pubDate>Wed, 14 Nov 2018 10:50:31 GMT</pubDate>
            <atom:updated>2018-11-14T10:50:31.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*wnmTzGdohC-MDZdl9kX54g.png" /></figure><p>Ever since I got involved in web design and front-end development, I’ve loved to write hand-coded, clean HTML and CSS. Although there are plenty of web editors that provide a WYSIWYG interface, I, along with many others, prefer to use the code view or a text editor to write code.</p><p>Why? Because it gives you more control. You know that every piece of markup is organic, ensuring its semantic nature. It’s also easier to maintain and edit later. When you’re coming back to a project after months, understanding your own handwritten code instead of a software-generated markup is always easier. This also helps in debugging and fixing when issues of cross-browser CSS compatibility arise.</p><p>Having said that, let’s face it — it does seem a little counterproductive and time consuming. Today the times are of agile methodology, and every minute counts. Rather than wasting time on writing and rewriting standard markup and all the combination of browser-specific CSS properties, there should be a way to speed up the process without affecting the semantics and structure of clean markup.</p><p>Well, there is: <a href="https://emmet.io/">Emmet</a>.</p><p>Emmet, previously known as Zen Coding, is one of the most productive and timesaving text editor plugins around. By instantly expanding simple abbreviations into complex code snippets, Emmet can help you save time and increase productivity, adding more power to your arsenal of front-end development.</p><p>The fun part is, that there is almost little to no learning curve if you’re already familiar with HTML and CSS. The format is very close to CSS and takes abbreviations for markup tags by generating and multiplying repeating elements. It’s almost like magic, only better.</p><h3>BASIC SYNTAX</h3><p>First, try mixing an HTML element’s name (e.g., <em>p</em>) with an identifier (e.g., <em>p#description</em>).</p><p>This will generate an HTML paragraph element with the id “description” assigned to it.</p><blockquote>Similarly, you can assign classes by using “.” instead of “#”. You can also add attributes by using square brackets. For example</blockquote><pre><em>a[href=#]</em></pre><p>will generate</p><pre>&lt;a href=”#”&gt; &lt;/a&gt;</pre><p>To define content and attributes for your HTML elements, use curly brackets. So, <em>h1{foo}</em> will produce this:</p><pre>&lt;h1&gt;foo&lt;/h1&gt;</pre><blockquote>This is just the beginning. You can also nest elements to create more complex markup. The power of Emmet is limitless.</blockquote><p>The child operator, represented by “&gt;” allows you to nest elements. The sibling operator, represented by “+” lets you place elements near each other, on the same level. Finally, the new climb-up operator, represented by “^”, allows you to climb up one level in the tree. So if you write <em>p&gt;span{foo},</em> it will generate:</p><pre>&lt;p&gt;&lt;span&gt;foo&lt;/span&gt;&lt;/p&gt;</pre><p>Similarly,<em> h1+h2</em> will generate:</p><pre>&lt;h1&gt;&lt;/h1&gt;<br>&lt;h2&gt;&lt;/h2&gt;</pre><h3>GROUPING</h3><p>To effectively take advantage of nesting without turning them into a confusing mess of operators, you’ll need to group some pieces of code. It’s like math–you just need to use parentheses around certain pieces. For example, <em>(.foo&gt;h1)+(.bar&gt;h2) </em>will generate this:</p><pre>&lt;div class=”foo”&gt;<br>     &lt;h1&gt;&lt;/h1&gt;<br>&lt;/div&gt;<br>&lt;div class=”bar”&gt;<br>     &lt;h2&gt;&lt;/h2&gt;<br>&lt;/div&gt;</pre><h3>MULTIPLICATION</h3><p>Another great feature is the ability to multiply your abbreviations for elements that would be repeated just be using the universal operator of multiplication, “*”. So, if you want 3 bullets in your bulleted list, you can simply write “<em>ul&gt;li*3″</em> and it will produce:</p><pre>&lt;ul&gt;<br>&lt;li&gt;&lt;/li&gt;<br>&lt;li&gt;&lt;/li&gt;<br>&lt;li&gt;&lt;/li&gt;<br>&lt;/ul&gt;</pre><p>You can even add dynamic numbering of content, attributes, and classes just by using a “$” sign. If you write <em>ul&gt;(li&gt;{item$})*3</em>, it will produce:</p><pre>&lt;ul&gt;<br>&lt;li&gt;item1&lt;/li&gt;<br>&lt;li&gt;item2&lt;/li&gt;<br>&lt;li&gt;item3&lt;/li&gt;<br>&lt;/ul&gt;</pre><h3>EMMET &amp; CSS</h3><p>Isn’t this amazing? But the fun doesn’t end here. Emmet also gives the same power (and some more) to CSS development.You can create CSS properties with values quickly. For example, “<em>w100″</em> will generate:</p><pre>width: 100px;</pre><p>It also supports other units instead of pixels like <em>em</em> and <em>even</em> percentage. Simply use “<em>p”</em> for percentage and “<em>e”</em> for em. For a font face property, all you have to write is “@f” and it will create complete a basic CSS block for font face.</p><pre>@font-face {<br>font-family:;<br>src:url();<br>}</pre><p>But this is just the beginning. Just add a “+” and see how far things can go. @f+ will generate:</p><pre>@font-face {<br>font-family: &#39;FontName&#39;;<br>src: url(https://medium.com/&#39;FileName.eot&#39;);<br>src: url(https://medium.com/&#39;FileName.eot?#iefix&#39;) format(&#39;embedded-opentype&#39;),<br>url(https://medium.com/&#39;FileName.woff&#39;) format(&#39;woff&#39;),<br>url(https://medium.com/&#39;FileName.ttf&#39;) format(&#39;truetype&#39;),<br>url(https://medium.com/&#39;FileName.svg#FontName&#39;) format(&#39;svg&#39;);<br>font-style: normal;<br>font-weight: normal;<br>}</pre><p>We all have issues remembering all kind of vendor prefixes for CSS and CSS3 properties. And then, there’s a thin chance of forgetting a particular browser, or its syntax. Not anymore. With Emmet, all you have to do is write -property and all vendor specific css will be generated for you to just add values.</p><p>For example, simply write “<em>-opacity”</em> and it will generate:</p><pre>-webkit-opacity: ;<br>-moz-opacity: ;<br>-ms-opacity: ;<br>-o-opacity: ;<br>opacity: ;</pre><h3>PLACEHOLDER TEXT</h3><p>So it supports HTML, creates CSS with values… there can’t be more to it, right? Wrong. While writing markup, we always need <em>lorem ipsum</em>. There’s no need to copy it from somewhere, or use a third-party source–Emmet generates it for you. Simply write “<em>lorem”</em> or “<em>ipsum”</em> and it will generate a block of lorem ipsum copy. You can even control the amount of text generated by supplying numeric values. For example, <em>lorem4</em> will generate:</p><pre>Lorem ipsum dolor sit.</pre><p>Also, lorem can be chained to other elements. So, “<em>article&gt;p*3&gt;lorem5″</em> will generate:</p><pre>&lt;article&gt;<br>&lt;p&gt;Lorem ipsum dolor sit amet.&lt;/p&gt;<br>&lt;p&gt;Esse in qui dolorem ex.&lt;/p&gt;<br>&lt;p&gt;Dolore, voluptates a ratione soluta!&lt;/p&gt;<br>&lt;/article&gt;</pre><h3>The Magic Piece of Code</h3><p>And here is a piece of code that I have come up with during my exposure with Emmet. I find it really useful and I thought it would be a good giveaway for my readers: a single line of code that will generate a whole page! Using all the combinations of Emmet, one line of code can create a complete layout of valid HTML5 page. All you need to do is simply write:</p><pre>html:5&gt;(header&gt;div#banner&gt;(a[href=page$.htm]&gt;img[src=&quot;path$.jpg&quot;])*3)+(aside&gt;ul&gt;li&gt;p*3&gt;lorem)+(article.module*4&gt;p*2&gt;lorem)+footer&gt;ul&gt;li&gt;a[href=&quot;#&quot;]*5</pre><p>Can you figure out what it will generate? If not, just install Emmet and give it a try. You will be pleasantly surprised.</p><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7df0643e634d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>