Created by Honza Šuráň
Every useful function or constant in Tornado is defined in tornado.core. You do not need any other namespace. It makes using the library as simple as possible!
Some of the functions & constants are named differently that what they later compile to. It is done so to avoid collisions with Clojure functions.
Mostly, everything is named how you would expect: (px 15),Pseudoclass/pseudoelement selectors: hover, first-line
Pseudoclass selectors with an arg: (nth-child :odd), (lang :en)
@rules: (at-media {& rules} & [effects]),
Color functions:
(hsl 80 0.5 0.5), (rotate-hue :red 30), (mix-colors :red :lime)
Sometimes to avoid collisions with Clojure functions:
(css-rem 15), (css-filter (blur (px 5)))
Combinators selectors: (has-val :a :target :blank)
| Clojure | CSS |
has-attr | [param] |
has-val | [param="value"] |
contains-word | [param~="value"] |
contains-subs | [param*="value"] |
starts-with-word | [param|="value"] |
starts-with | [param^="value"] |
ends-with | [param$="value"] |
All the selectors can also have an element specified to limit the selector effects:
(ends-with :src ".png") => [src$=".png"]
(ends-with :img :src :.png) => img[src$=".png"]
(:require-macros [tornado.units :refer [defunit]])(:require [tornado.core :refer [px rgb hover])Attribute selectors select all descendant elements containing a given substring, of which the the value matches a given substring. All attribute selectors have different conditions for matching. Dashes count as word separators. By attributes, it is meant html attributes:
Clojure: (contains-word :div :class :.info)
CSS: div[class~="info"]
Class and id selectors style HTML element with the given class or id, optional conditional nesting allowed.
https://github.com/JanSuran03/tornado
https://github.com/JanSuran03/lein-tornado
In CSS, selectors are an essential thing; they specify, which elements should be styled. There are several types of selectors:
Class sel., id sel., element sel., attribute sel., combinator sel., pseudoclass sel. (some of them can have an argument), pseudoelement sel. and some special selectors.
Since in HTML the structure is basically elements nested into another elements, the CSS selectors work them same.
Element selectors style each HTML element, optional conditional nesting allowed.
Used to style a specific part of an element. Equal usage in code as pseudoclass selectors:
The "&" selector selects the current selectors nesting level (see @media).
The "*" selector selects all children (see pseudoclass selectors with an argument).
Pseudoclass selectors change properties of elements based on some special state they currently have: