Last active
January 9, 2017 15:26
-
-
Save klemola/dfc3203481768372b5da99136b6c7ccf to your computer and use it in GitHub Desktop.
Example of using elm-css in style tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (..) | |
import Css.File | |
import MyCss | |
import Html exposing (div, text, node) | |
import Html.Attributes exposing (id, class) | |
css = | |
Css.File.compile [ MyCss.css ] | |
view = | |
div [] | |
[ div [ class "NavBar" ] [ text "this has the NavBar class" ] | |
, div [ id "Page" ] [ text "this has the Page id" ] | |
, node "style" [] [ text css.css ] | |
] | |
main = | |
Html.program | |
{ init = ( (), Cmd.none ) | |
, view = \_ -> view | |
, update = \_ _ -> ( (), Cmd.none ) | |
, subscriptions = \_ -> Sub.none | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyCss exposing (..) | |
import Css exposing (..) | |
import Css.Elements exposing (body, li) | |
import Css.Namespace exposing (namespace) | |
type CssClasses | |
= NavBar | |
type CssIds | |
= Page | |
css = | |
(stylesheet << namespace "dreamwriter") | |
[ body | |
[ overflowX auto | |
, minWidth (px 1280) | |
] | |
, (#) Page | |
[ backgroundColor (rgb 200 128 64) | |
, color (hex "CCFFFF") | |
, width (pct 100) | |
, height (pct 100) | |
, boxSizing borderBox | |
, padding (px 8) | |
, margin zero | |
] | |
, (.) NavBar | |
[ margin zero | |
, padding zero | |
, children | |
[ li | |
[ (display inlineBlock) |> important | |
, color primaryAccentColor | |
] | |
] | |
] | |
] | |
primaryAccentColor = | |
hex "ccffaa" |
Author
klemola
commented
Jan 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment