This page describes how the extra styles for the about page on this site are generated.
Preamble
As usual, we start with defining the main module, module imports, and writing the CSS stylesheet to standard output.
module Main (main) where
import Clay
import Clay.Media qualified as Media
import Web.Site.Styles (narrowWidth)
import Prelude hiding (div)
main :: IO ()
= putCss $ do
main profilePhotoStyle
Profile photograph
This styles the profile photograph on the about page. First, we define which HTML element corresponds to the profile photograph.
profileElement :: Selector
= img # ".profile-photo" profileElement
For all cases, there is a bit of padding around the photograph.
profilePhotoStyle :: Css
= do
profilePhotoStyle ? do
profileElement $ em 1
sym padding
wideProfilePhotoStyle narrowProfilePhotoStyle
When the width is large enough, the profile photograph will float to the right and have a fixed size.
wideProfilePhotoStyle :: Css
= do
wideProfilePhotoStyle $ do
query Media.all [Media.minWidth narrowWidth] ? do
profileElement
display inlineBlock
float floatRight$ em 8
width $ em 8 height
When the width is narrow, the profile photograph will be in its own block and centered.
narrowProfilePhotoStyle :: Css
= do
narrowProfilePhotoStyle $ do
query Media.all [Media.maxWidth narrowWidth] ? do
profileElement
display block
float none
marginLeft auto
marginRight auto$ pct 50
maxWidth $ em 8
width
height auto"aspect-ratio" -: "auto"