Safe Haskell | None |
---|---|
Language | Haskell2010 |
Clay.Geometry
Synopsis
- size :: Size a -> Css
- top :: Size a -> Css
- left :: Size a -> Css
- bottom :: Size a -> Css
- right :: Size a -> Css
- width :: Size a -> Css
- height :: Size a -> Css
- minWidth :: Size a -> Css
- minHeight :: Size a -> Css
- maxWidth :: Size a -> Css
- maxHeight :: Size a -> Css
- data AspectRatio
- aspectRatio :: AspectRatio -> Css
- (%) :: Integer -> Integer -> AspectRatio
- withFallback :: AspectRatio -> AspectRatio -> AspectRatio
- padding :: Size a -> Size a -> Size a -> Size a -> Css
- paddingTop :: Size a -> Css
- paddingLeft :: Size a -> Css
- paddingRight :: Size a -> Css
- paddingBottom :: Size a -> Css
- margin :: Size a -> Size a -> Size a -> Size a -> Css
- marginTop :: Size a -> Css
- marginLeft :: Size a -> Css
- marginRight :: Size a -> Css
- marginBottom :: Size a -> Css
Positioning.
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
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.
paddingTop :: Size a -> Css Source #
paddingLeft :: Size a -> Css Source #
paddingRight :: Size a -> Css Source #
paddingBottom :: Size a -> Css Source #
Margin.
marginLeft :: Size a -> Css Source #
marginRight :: Size a -> Css Source #
marginBottom :: Size a -> Css Source #