clay-0.16.0: CSS preprocessor as embedded Haskell.
Safe HaskellNone
LanguageHaskell2010

Clay.Geometry

Synopsis

Positioning.

size :: Size a -> Css Source #

top :: Size a -> Css Source #

left :: Size a -> Css Source #

Sizing.

Aspect ratio.

data AspectRatio Source #

Represents an aspect ratio for use with aspectRatio.

A fixed ratio can be formed from two integers:

>>> let _ = 4%3 :: AspectRatio

An aspect ratio can also be converted from a Rational:

>>> let _ = fromRational 0.5 :: AspectRatio

Instances

Instances details
Num AspectRatio Source #

An AspectRatio can be converted from an Integer, but other operations are not supported.

Instance details

Defined in Clay.Geometry

Fractional AspectRatio Source #

An AspectRatio can be converted from a Rational, but other operations are not supported.

Instance details

Defined in Clay.Geometry

Auto AspectRatio Source # 
Instance details

Defined in Clay.Geometry

Inherit AspectRatio Source # 
Instance details

Defined in Clay.Geometry

Initial AspectRatio Source # 
Instance details

Defined in Clay.Geometry

Other AspectRatio Source # 
Instance details

Defined in Clay.Geometry

Unset AspectRatio Source # 
Instance details

Defined in Clay.Geometry

Val AspectRatio Source # 
Instance details

Defined in Clay.Geometry

aspectRatio :: AspectRatio -> Css Source #

Defines the width to height ratio of an element. At least one of the width or height must be of automatic size, otherwise the aspect ratio will be ignored.

It can be given a fixed ratio of the width to the height:

>>> renderWith compact [] $ aspectRatio (4%3)
"{aspect-ratio:4/3}"

It can also be the intrinsic aspect ratio for the element:

>>> renderWith compact [] $ aspectRatio auto
"{aspect-ratio:auto}"

It can be told to use the intrinsic aspect ratio for the element, but to use a fixed ratio while it is unknown or if the element does not have one:

>>> renderWith compact [] $ aspectRatio $ auto `withFallback` (4%3)
"{aspect-ratio:auto 4/3}"

Corresponds to the aspect-ratio property in CSS.

(%) :: Integer -> Integer -> AspectRatio infixl 7 Source #

The aspect ratio of the width to the height for use with aspectRatio.

Note that this is not the same % operator from the Data.Ratio module, although they do both semantically represent ratios. The same symbol is used to signify that the return value is a ratio.

withFallback :: AspectRatio -> AspectRatio -> AspectRatio Source #

Returns an aspect ratio specifying that the intrinsic aspect ratio should be used, but when it is unknown or there is none, a fixed ratio can be used as a fallback.

Padding.

padding :: Size a -> Size a -> Size a -> Size a -> Css Source #

Margin.

margin :: Size a -> Size a -> Size a -> Size a -> Css Source #