Tromsø mountains, Norway, Photo by Frank Thomsen Semstrap

Simple styles for semantic HTML that don't make your eyes bleed

About Semstrap

Many developers turn to frontend frameworks just to easily improve the looks of their web projects. Unfortunately this approach results in a loot of framework-specific code like class names and wrapping elements being added to your HTML. Sometimes you even end up adding a bit of code from a another web project that relies on a different front end framework and you get a mess of dependencies and conflicting class names.

Semstrap styles only targets elements. When you want to use it to style a form element you just add the element like so:

<form>
    <label for="inputEmail">Email address</label>
    <input id="inputEmail" type="email">
</form>
                    

... as opposed to:

<form class="form form-modifier">
    <div class="form__wrapper form__wrapper-modifier">
        <label class="form__wrapper__label" for="exampleInputEmail1">Email address</label>
        <input class="form__wrapper__input form__wrapper__input-modifier" type="email" id="exampleInputEmail1">
    </div>
</form>
                    

Check it out on Github: https://github.com/iamfrank/semstrap

Using it

If you want to use Semstrap in your project, just download semstrap.css and add it to your project's head section:

<link rel="stylesheet" type="text/css" href="semstrap.css">

That's it. Take a look beneath to see the cool stuff you can build with pure HTML elements and Semstrap.

Article

The <article> element is a semantic wrapper for anything that can be percieved as a single unit of information or functionality. Examples are a blog post or a signup form.

Articles are semantic containers and they don't need a lot of styling (we save that for the content), but we assume a padding inside any article would make it's content easier to distinguish from other parts of your webpage.

Stuff inside an article

Buttons

Buttons in forms

Code

Some code

Forms

Check out more form examples.

Definition list

Term A
Definition description A
Term B
Definition description B.
Can be an entire multiline paragraph.
Term C
Definition description C

Headings

Headings are defined with the <h1> to <h6> tags. <h1> defines the top level heading

This is a heading level 1

This is a heading level 2

This is a heading level 3

This is a heading level 4

This is a heading level 5
This is a heading level 6

Tables

Tables are for displaying large datasets in a structured manner.

Table header 1 Table header 2 Table header 3
Table data 1.1 Table data 1.2 Table data 1.3
Table data 2.1 Table data 2.2 Table data 2.3
Table data 3.1 Table data 3.2 Table data 3.3

Thematic break (hr)

Some content before divider


Some content after divider