Comet is a lightweight CSS toolkit for clean and fast web apps. It's written with the BEM methodology in mind for a more structured and readable code. No unnecessary styles are added, so you can spend more time building things and less time overriding.
There are several different ways to get started with Comet, you can choose the most suitable option for your needs.
Download Cometnpm install comet-css --save
bower install comet-css --save
<link href="https://npmcdn.com/comet-css@1.2.0/dist/comet.min.css" rel="stylesheet">
First, use a method above to download Comet. Then just add these tags in the head of your HTML file.
<!-- Comets default font -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700" rel="stylesheet">
<!-- Minified Comet (installed via npm) -->
<link href="./node_modules/comet/dist/comet.min.css" rel="stylesheet">
๐ผ Beam me up
Comet uses the Source Sans Pro family as the default sans serif
font for headlines and body copy. Monaco is used as default monospace font for code snippets.
You can easily change the default fonts. For more information check the customization chapter.
font-size: 45px / line-height: 54px
font-size: 37px / line-height: 45px
font-size: 31px / line-height: 37px
font-size: 26px / line-height: 31px
font-size: 22px / line-height: 26px
font-size: 15px / line-height: 18px
You can use different html tags to emphasis your text.
<strong>Strong</strong>
<em>Italic</em>
<u>Underline</u>
<strike>Strike</strike>
<small>Small</small>
All font-sizes are based on a typographic scale. If you change the base font size, all font sizes will scale proportionally.
๐ผ Beam me upBlockquotes are used to label text that is quoted from another source.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
<blockquote class="blockquote blockquote--highlight">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer class="blockquote__footer">โ Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>
๐ผ Beam me up
You can use the <code>
tag to wrap text that represents computer code. By default <code>
is a inline element.
If you need a block of code wrap the <code>
tag within the <pre>
element.
.test-class {
color: red;
}
<pre><code class="code">
.test-class {
color: red;
}
</code></pre>
There are also some modifier classes like .code--background
and .code--highlight
avaliable.
var x = 10;
<pre><code class="code code--background code--highlight">
var x = 10;
</code></pre>
For syntax highlighting you can use prismjs.
๐ผ Beam me upYou can use the default <ul>
, <ol>
and <dl>
lists.
<!-- Unordered list -->
<ul class="list">
<li>Item #1<li>
<li>Item #2<li>
</ul>
<!-- Ordered list -->
<ol class="list">
<li>Item #1<li>
<li>Item #2<li>
</ol>
<!-- Description list -->
<dt class="list">
<dt>Item #1<dt>
<dd>Description<dd>
</dt>
With the following modifiers you can change the appearance of a list.
<ul class="list list--inline">
<li>Item #1</li>
<li>Item #2</li>
<li>Item #3</li>
</ul>
<ul class="list list--unstyled">
<li>Item #1</li>
<li>Item #2</li>
<li>Item #3</li>
</ul>
๐ผ Beam me up
# | Name | |
---|---|---|
1 | John Doe | john@doe.com |
2 | Leanne Graham | sincere@april.biz |
3 | Ervin Howell | shanna@melissa.tv |
<table class="table">
โฆ
</table>
# | Name | |
---|---|---|
1 | John Doe | john@doe.com |
2 | Leanne Graham | sincere@april.biz |
3 | Ervin Howell | shanna@melissa.tv |
<table class="table table--striped">
โฆ
</table>
# | Name | |
---|---|---|
1 | John Doe | john@doe.com |
2 | Leanne Graham | sincere@april.biz |
3 | Ervin Howell | shanna@melissa.tv |
<table class="table table--hover">
โฆ
</table>
๐ผ Beam me up
<form class="form">
<label class="form__label" for="name">Name</label>
<input class="form__input" type="text" id="name" placeholder="Your name">
<label class="form__label" for="email">Email</label>
<input class="form__input" type="email" id="email" placeholder="Your email" />
<label class="form__label" for="message">Message</label>
<textarea class="form__input" id="message" placeholder="Your message"></textarea>
<button type="button" class="button">Submit</button>
</form>
For valid and invalid form inputs you can use the modifier classes .form__input--success
and .form__input--error
.
<form class="form">
<div class="grid">
<div class="grid__col grid__col--6">
<input class="form__input form__input--success" type="text" placeholder="Your name" />
</div>
<div class="grid__col grid__col--6">
<input class="form__input form__input--error" type="text" placeholder="Your name" />
</div>
</div>
</form>
๐ผ Beam me up
Comet provides a simple grid using flexbox.
<div class="grid">
<div class="grid__col grid__col--12"></div>
<div class="grid__col grid__col--1"></div>
<div class="grid__col grid__col--11"></div>
<div class="grid__col grid__col--2"></div>
<div class="grid__col grid__col--10"></div>
<div class="grid__col grid__col--3"></div>
<div class="grid__col grid__col--9"></div>
<div class="grid__col grid__col--4"></div>
<div class="grid__col grid__col--8"></div>
<div class="grid__col grid__col--5"></div>
<div class="grid__col grid__col--7"></div>
<div class="grid__col grid__col--6"></div>
<div class="grid__col grid__col--6"></div>
</div>
Depending on the screen size you can use different classes to resize your columns.
<!-- Medium sized devices -->
grid__col--m-*
<!-- Small devices -->
grid__col--s-*
The shortcut m
stands for medium
sized devices e.g. Tablets. s
stands for small
devices e.g. smartphones.
<div class="grid">
<div class="grid__col grid__col--8 grid__col--m-6 grid__col--s-12"><div class="demo">Hello</div></div>
<div class="grid__col grid__col--4 grid__col--m-6 grid__col--s-12"><div class="demo">world</div></div>
</div>
The grid module also has two modifiers:
<div class="grid grid--reverse">
โฆ
</div>
<div class="grid grid--gapless">
โฆ
</div>
๐ผ Beam me up
Comet provides a couple of useful utilities to boost your productivity.
Left aligned text.
<p class="utility__text--center">Left aligned text.</p>
Center aligned text.
<p class="utility__text--center">Center aligned text.</p>
Right aligned text.
<p class="utility__text--right">Right aligned text.</p>
This text is loud.
<p>This text is <span class="utility__text--loud">loud</span>.</p>
This text is quiet.
<p>This text is <span class="utility__text--quiet">quiet</span>.</p>
This text is highlighted.
<p>This text is <span class="utility__text--highlight">highlighted</span>.</p>
<div class="utility__pos--left" style="width: 100px;">This div is left aligned.</div>
<div class="utility__pos--right" style="width: 100px;">This div is right aligned.</div>
<div class="utility__pos--center" style="width: 100px;">This div is horizontal centered.</div>
<div style="position: relative; height: 200px;">
<div class="utility__pos--center-center">This div is horizontal and vertical centered (in it's container).</div>
</div>
This paragraph floats to the left.
<p class="utility__float--left">This paragraph floats to the left.<p>
This paragraph floats to the right.
<p class="utility__float--right">This paragraph floats to the right.<p>
The class .utility__clearfix
clears all floats.
<div class="utility__clearfix">
<div class="utility__float--left">Left</div>
<div class="utility__float--right">Right</div>
<div>
This text is hidden on large devices.
<p class="utility__hidden--l">This text is hidden on large devices.</p>
This text is hidden on medium devices.
<p class="utility__hidden--m">This text is hidden on medium devices.</p>
This text is hidden on small devices.
<p class="utility__hidden--s">This text is hidden on small devices.</p>
๐ผ Beam me up
To divide sections you can use the html tag hr
.
<hr class="hr" />
<hr class="hr hr--small" />
๐ผ Beam me up
Comet uses autoprefixer to make features compatible with earlier browser versions. Comet is compatible with:
To build a customised version, make sure that you have node.js and gulp.js installed, then:
https://github.com/marcbruederlin/comet.git
cd comet
npm install
src/custom/_variables.scss
gulp build
to regenerate the dist folder. gulp build --watch
to watch for file changes and automatically rebuild the files.