Skip to content

A container for HTML that maintains its aspect ratio

License

Notifications You must be signed in to change notification settings

sch/elm-aspect-ratio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-aspect-ratio

A container for HTML that maintains its aspect ratio.

AspectRatio.view : Ratio.Rational -> Html a -> Html a
AspectRatio.img : Ratio.Rational -> String -> Html a

example

import Ratio
import AspectRatio
import Html exposing (Html, div)
import Html.Attributes exposing (style)

cinematic : Ratio.Rational
cinematic = Ratio.over 9 16

redRectangle =
    div [ style [ ( "background-color", "red" )
                , ( "width", "100%" )
                , ( "height", "100%" )
                ] ] []

cinematicImage : String -> Html a
cinematicImage src =
    AspectRatio.view cinematic redRectangle

About

A container for HTML that maintains its aspect ratio

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages