• Stars
    star
    205
  • Rank 191,264 (Top 4 %)
  • Language
    CSS
  • License
    Other
  • Created about 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple, opinionated stylesheet for formatting semantic HTML to look like a CSS file.

#CSSCV

CSSCV is a simple, opinionated stylesheet for formatting semantic HTML to look like a CSS file.

Getting started

The simplest way to get started with CSSCV is to dive right into the HTML and get editing! There is nothing in the Sass that isn’t used in the HTML, so the index.html file acts as a comprehensive, real-world demo of what CSSCV can do.

Below is a more detailed overview of the ins-and-outs of the way CSSCV works.

Opinionated?

CSSCV matches my own personal style of writing CSS, and uses a specific colour scheme, Solarized. Some of its other more opinionated features:

Enabling

CSSCV comes with the option to [en|dis]able its styling. This is so that you can quickly and easily remove CSSCV’s unconventional look, and instead expose unstyled HTML in case you ever need to provide a more standard format of CV to recruiters or HR teams. Boring, but often vital. Enabling CSSCV is as simple as adding a class of .csscv the the html element; all of CSSCV’s styles are scoped to this namespace.

Making stuff work

There are a series of simple yet strict rules to follow in order to use CSSCV. Rulesets are built using definition lists and comments and selectors are usually constructed using headings. Below is a simple example that we will deconstruct:

<div class="ruleset">

    <h3 class="selector">Me</h3>

    <dl class="declarations">

        <dt class="property">Name</dt>
        <dd class="value"><span class="string">Harry Roberts</span></dd>

        <dt class="property">Job</dt>
        <dd class="value"><span class="string">Consultant Front-end Architect</span></dd>

        <dt class="property">Location</dt>
        <dd class="value"><span class="string">Leeds, UK</span></dd>

        <dt class="property">Skills</dt>
        <dd class="value">
            <ul class="value-list">
                <li><span class="string">Front-end Architecture</span></li>
                <li>Design</li>
                <li>Development</li>
                <li>OOCSS</li>
                <li>Performance</li>
                <li><span class="string">Responsive Web Design</span></li>
                <li>Git</li>
                <li>Vim</li>
                <li>Agile</li>
            </ul>
        </dd>

    </dl>

</div>

Let’s take a look at what this does:

  • We wrap each ruleset in a container with a .ruleset class.
  • The title, or selector, of that ruleset is a heading which carries the .selector class.
  • The declarations that make up the ruleset are marked up in a dl which has a class of .declarations.
  • Each property/value pair are marked up with dts and dds respectively. These, respectively, carry classes of .property and .value.
  • Any strings that would require quoting in CSS (e.g. "Comic Sans MS") can be wrapped in a span with a class of string. This colours them differently and applies opening and closing quote marks.
  • Lists of values (e.g. font-family: "Comic Sans MS", cursive;) are marked up as either ordered- or unordered-lists which carry a class of .value-list.

As we can see, the rulesets are formed of semantic HTML elements and heavy use of CSS pseudo-elements are used to apply CSS-like syntax (braces, (semi-)colons, quotes, etc).

What the classes do

.csscv

This class gets applied to the html element and enables CSSCV

.spaced

This class forces all elements which carry it to have one carriage return’s space between itself and the following element.

.spaced--large

This increases the spacing from one to five carriage returns.

.indented

Anything carrying this class will be indented by your chosen tab size amount (defined in $tab-size).

.ruleset

This class is applied to an element which wraps each whole ruleset. It spaces rulesets apart from each other, and can also carry the .spaced--large or .indented classes.

.selector

This class is applied to headings which introduce each ruleset. It adds a period before, and an opening brace after, the title of the ruleset.

.selector__delimiter

This class is applied to an empty span in order to hyphen-delimit multi-word selectors. For example:

<h2 class="selector">About<span class="selector__delimiter"> </span>me</h2>

.declarations

This class is applied to the definition list that will form the body of the ruleset. It adds a closing brace after the final declaration.

.property

This class is applied to each dt element which is a declaration’s property. It indents the declaration as per your chosen tab size and adds a trailing colon and space.

.value

This is applied to each dd element which becomes a declaration’s value. It adds a trailing semi-colon.

.string

CSS often has values which contain spaces which need quoting, wrap these strings in a span that carries the .string class.

.number

This class simply colours any number-like values (e.g. 34px, #f00).

.url

Any URL-like values can have the .url class applied to them to prepend url( and append ) to it.

.value-list

CSS often contains comma-delimited lists of values. In CSSCV we mark these up as uls and lis. The ul take the .value-list class.

.element and .modifier

These two classes allow you to use BEM-style naming without polluting your markup. To signify an element or modifier, use the corresponding class. You need to also use the data-namespace attribute in order to prepend the class with the correct block name, e.g.:

<h3 class="selector">Job</h3>

...

<h4 class="selector"><span class="modifier" data-namespace="job">Company</span></h4>

.comment, .comment-block and .comment-block__line

These classes, unsurprisingly, style markup to look like comments. The .comment class gives an inline comment, whilst .comment-block gives us a DocBlock style comment:

<p class="comment-block">
    <span class="comment-block__line">Foo</span>
    <span class="comment-block__line">Bar</span>
    <span class="comment-block__line">Baz</span>
</p>

.notice

This is the attribution message that appears at the bottom of the CSSCV page. Including the message is not mandatory, but is appreciated.

More Repositories

1

inuit.css

Powerful, scalable, Sass-based, BEM, OOCSS framework.
CSS
3,838
star
2

CSS-Guidelines

High-level guidelines for writing manageable, maintainable CSS
3,653
star
3

ct

Let’s take a look inside your <head>…
CSS
1,848
star
4

csswizardry-grids

Simple, fluid, nestable, flexible, Sass-based, responsive grid system.
CSS
1,491
star
5

typecsset

A small Sass library for setting type on the web.
CSS
713
star
6

csswizardry.github.com

My site.
HTML
463
star
7

nudge

Warn developers about improper selector usage
CSS
225
star
8

beautons

A beautifully simple button toolkit
CSS
211
star
9

vanilla

My personal starting point for new builds.
HTML
184
star
10

discovr

CSS Architecture workshop files
CSS
172
star
11

frcss

CSS
107
star
12

dotfiles

Starting small… my dotfiles for a few things.
Vim Script
102
star
13

inuit.css-web-template

Web template for housing the inuit.css framework as submodule
CSS
88
star
14

ama

Ask me anything!
58
star
15

recipes

Collection of things I like cooking
42
star
16

pr.ofile.me

Digital, mobile business cards
40
star
17

hry.rbrts.me

Personal hub site.
Racket
20
star
18

build-along-1

The first CSS Wizardry build-along
17
star
19

css-architecture

Workshop materials
CSS
16
star
20

fluid-grids

PHP
15
star
21

extend-vs-mixin

CSS
13
star
22

work

Dedicated ‘work’ page for CSS Wizardry
HTML
12
star
23

fep

9
star
24

sampenrose.co.uk

Portfolio
6
star
25

demo-component

CSS
5
star
26

harry.is

HTML
3
star
27

gilliansibthorpe.com

HTML
2
star
28

questions-for-consultants-issues

Public issue tracker for my eBook, Questions for Consultants
2
star
29

test

1
star
30

wishlist

Because I’m greedy like that…
1
star
31

press

Bios and stuff…
1
star
32

toolkit-core

CSS
1
star
33

piccalilli-burger-menu-demo

HTML
1
star
34

markrabey.github.io

CSS
1
star
35

nightingale-demo

HTML
1
star
36

bower-demo

CSS
1
star