Git Product home page Git Product logo

html-snippets's Introduction

Sublime Text HTML Snippets

A work in progress.

Type the snippet shortcode and then press Tab to complete the snippet.

The snippets are listed below in alphabetical order. The '$1' indicates the position of the caret/s. Some snippets have been set up so that pressing Tab jumps the caret/s to the next predefined spot. It's a little hard to explain, but any snippet that has a $1/$2/$3/etc. uses this technique.

Feel free to play with, alter, expand, or ruin these snippets as you please. I only ask that if you come up with an incredibly handy snippet, or simply one that I have missed, that you let me know (via email, Twitter or GitHub) so that I can improve these for everybody. Thanks!

IMPORTANT: If you are also using Emmet, add the following to Emmet's user settings file:

"disabled_single_snippets": "fig meta nav ol script style ul"


a

<a href="$1">$2</a>

comm

<!-- $1 -->

cond

<!--[if ${1:lt IE 9}]>
    <link rel=stylesheet href="${2:css/ie.css">}
<![endif]-->

doctype

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="description" content="$1">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>${2:Untitled}</title>
        <link rel="stylesheet" href="css/style.css">
        <link rel="author" href="humans.txt">
    </head>
    <body>
        $3
        <script src="js/main.js"></script>
    </body>
</html>

dummy

One morning, when Gregor Samsa woke from troubled dreams, he found himself
transformed in his bed into a horrible vermin. He lay on his armour-like back,
and if he lifted his head a little he could see his brown belly, slightly domed
and divided by arches into stiff sections. The bedding was hardly able to cover
it and seemed ready to slide off any moment. His many legs, pitifully thin
compared with the size of the rest of him, waved about helplessly as he looked.
"What's happened to me? " he thought.

fig

<figure>
    <img src="$1" alt="$2">
    <figcaption>$3</figcaption>
</figure>

ga

<script>
    var _gaq = [['_setAccount', '${1:UA-XXXXX-X}'], ['_trackPageview']];
    (function(d, t) {
        var g = d.createElement(t),
            s = d.getElementsByTagName(t)[0];
        g.src = '//www.google-analytics.com/ga.js';
        s.parentNode.insertBefore(g, s);
    }(document, 'script'));
</script>

ga2

<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', '${1:UA-XXXX-X}');
    ga('send', 'pageview');
</script>

img

<img src="$1" alt="$2">

jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

lorem

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

meta

<meta charset=utf-8>
<meta name=description content="$1">
<meta name=viewport content="width=device-width, initial-scale=1">

nav

For when using inline-block.

<nav class="$1">
    <ul>
        <li><a href="#">$2</a></li><!--
     --><li><a href="#">$3</a></li><!--
     --><li><a href="#">$4</a></li><!--
     --><li><a href="#">$5</a></li>
    </ul>
</nav>

nav2

<nav class="$1">
    <ul>
        <li><a href="#">$2</a></li>
        <li><a href="#">$3</a></li>
        <li><a href="#">$4</a></li>
        <li><a href="#">$5</a></li>
    </ul>
</nav>

ol

<ol>
    <li>$1</li>
    <li>$2</li>
    <li>$3</li>
    <li>$4</li>
</ol>

script

<script src="$1"></script>

shiv

<!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

style

<link rel=stylesheet href="$1">

ul

<ul>
    <li>$1</li>
    <li>$2</li>
    <li>$3</li>
    <li>$4</li>
</ul>

inp:text

<input type="text">

inp:tel

<input type="tel">

inp:radio

<input type="radio">

inp:check

<input type="checkbox">

inp:email

<input type="email">

inp:pass

<input type="password">

inp:submit

<input type="submit">
<style type="text/css">$1</style>

html-snippets's People

Contributors

dancasttro avatar edgarshurtado avatar hendrasan avatar johanneszorn avatar joshnh avatar radlikewhoa avatar romainberger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html-snippets's Issues

Update Repository Description

The description of this repo says it only work with Sublime Text 2, but the package info indicates it works with ST3 also.

Swap nav and nav2?

Although I agree with you preferring the inline-block method to display a list horizontally, floated lis are by far more common. I don't know if you agree with me, but I'd say having the more common variant as the primary method is preferable. If people really want to use the inline-block method as default, they can still change the snippets manually.

html snippets not working

Hi, Josh,
I am using sublimtext 2, macosx 10.8.5,
I am also using Emmet and modified the emmet user settings to this.
{
"disabled_single_snippets": "fig meta nav ol script style ul"
}

for some reason, the html snippet is not working at all on my machine. Wonder if you have any insight?

Stylesheet rel missing quotes

Hey Josh,
Thanks for the set of snippets. I'm new to GitHub; just wanted to let you know I noticed the 'rel' attribute in the stylesheet snippet is missing the quotes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.