I wish there would be a "lower level" language all CSS and HTML could be translated to, so both levels could have a "reasonable" formal specification...
FWIW, while there are unfortunately only very few attempts at formalizing CSS, there's at least an unofficial, unreviewed (?), partial formal semantics for (CSS 2-era) float layout based on z3 SMT and Racket you can take a look at to get a flavor, though it isn't receiving further development.