Declarations is an ongoing artistic research project into the poetic materiality of the CSS web-standard and its visual-political-cultural echoes on design-artistic practices and our daily lives. Declarations is a love letter to the crafts of designing with language.

Declaring shapes with words on the web


Start here if you're not sure where to start

This page purpose is to introduce anyone to the CSS language. It isn't a tutorial, but rather a quite organic and subjective presentation of the language functionnality, directed to open the door to playfullness and wonder.

The best advice for declarative amateurs

If at any point you are not sure of what to do with certain CSS properties, you can always

An example of declarations

Let's look at one declarations block of CSS.

p{
    background: greenyellow;
    color: navy;
    border-radius: 2em;
    padding: 1em;
    font-size: 16px;
    max-width: 60%;
    margin: 3em auto;
    box-shadow: 0 0 1em 0 aqua;
}

This paragraph has a greenyellow background, is colored in navy. Its border are rounded, with a radius of 2 time the size of the font. There is space in between the edges of the paragraph and the start of the text equal to the size of the font. The font size itself is fixed at 16 pixels. The paragraph will take a sixth of the width of its parent, leaving space on the side. The vertical margin is 3 time the size of the font, and the left and right margin are going to be distributed equally. Finally a shadow is applied on the box that is the paragraph, the shadow has no top or left offset, and spread on a zone that takes the size of the font, diffusing a aqua color.

Our declarations block is composed of a few sections

Boxes nested inside boxes

In HTML, elements are boxes inside of each others. CSS then, shapes the boxes and their form/behavior/space inside of each others.

outside

inside

From the outside to the inside of each box, we meet

Elements (or boxes) have default sizing behavior depending on their nature. However we can control their size using

Selectors

Selectors are powerful simple magic formulation. In order to shape anything on a webpage, we first need to write a selector, it will look at the page and grab certain elements only, on which we want to apply a style.

a, p, body, imgsemantic selector, grab elements based on their HTML tag.
.flowerclass selector, grab elements based on their class attribute
#my-flowerid selector, grab elements based on their id attribute
blockquote aspace is used to grab only the elements inside of specific other element (here: the link inside a quote)
blockquote > agrab only the elements directly inside (called the children) of specific other element (here: the link that are children of a quote)
p:nth-of-type(odd), p:nth-of-type(even) and p:nth-of-type(7)grab elements that are in a certain place in the HTML code

Units

pxpixels
%relative to parent box
emrelative to font-size of current element
vw and vhrelative to browser window width and height

Before & After

[to be writen]

Other tutorials

Some external ressources and tutorials we like are the following. If you're interested in learning web-language, free an afternoon, make yourself some tea, and pick one of those.