5 ms·
I find the bifurcation between HTML elements and CSS statements maddening. Structural things like flexbox and grid would be far clearer as HTML element types.
by ibiza 3y ago
I find the bifurcation between HTML elements and CSS statements maddening. Structural things like flexbox and grid would be far clearer as HTML element types.
- manuelmoreale 3y agoCare to share an example of what you mean? Because I don't understand how that would look honestly.
- c-hendricks 3y agoSee any grid component in a library for React for example.
- manuelmoreale 3y agoAh so everything kinda inline? But how do you deal with change of layouts then? Like, sometimes I code sites where the inner structure changes a lot and that's trivial when paired with media queries but it would be a pain to handle if everything is inlined or tied to the markup.
- deleted 3y ago[deleted]
- c-hendricks 3y agothe Grid from Mui / joy UI, for instance, let's you set sizes for different screen witdhs via props: https://mui.com/joy-ui/react-grid/#introduction https://mui.com/joy-ui/react-grid/#introduction Since it's done with JSX/Props, it's API is a 1:1 translation to a new HTML element.
- stefanfisk 3y agoHow would that work when you need to switch stuff like `display` responsively?
- dflock 3y agoHTML is for marking up the semantics of content - lists, headings, emphasis, etc… CSS is for presentation - how is appears in the target medium. The layout is 100% visual presentation and 100% belongs where it is, in CSS. Dealing with multiple screen/windows/paper sizes, as well as dynamic resizing & scaling is incredibly hard or impossible when you've baked a fixed idea of presentation into your content, see: Latex, PDFs & old school HTML with complex tables for layout, for examples.