Is it better to keep this page as is or use grid? I was not sure about grid because the amount of content in each section is different…and I would like to keep the borders on the same level as shown with red arrows on the above pic.
P.S. The above screenshot is taken in Chrome. I just discoverd that the borders are not on the same level in Firefox. I guess that’s because I used pixels in some cases for margins…
You must have made it fit at the exact width you had your page open
You can line those up with flex or grid but for flex you’d need to do each small block individual horizontally in pairs and then they will align on each row.
With grid you would need all individual items as direct children of the parent and then you could place each block as required into the grid structure.
For both of the above you would need a div around each heading and associated text in order to place them.
As your heading text will wrap at small widths and become taller then it’s probably a job for grid as you need a row and column alignment (like a table). (Indeed display:table could do this but is not so flexible).
No, I would prefer to keep the order of items unchanged if possible. Left column - introductions and services offered and right column - course outline. I think it would make more sense for the reader at least on desktop views. In mobile view I would stack course outline column below introductions and services offered.
P.S. I really like your solution though…trims down my spaghetti code significantly
That complicates things a little and ties your css to your mark up order which is something I don’t like to do. You could output the items from your backend as 1, 3 and 5 and then they will align to the left by default.
Otherwise you have to be specific and address each element in the css. I wouldchange the order using the order property but that isn’t a lot different from named grid areas.
Yes that message is nonsense as it’s the parent’s display that allows the direct child to be ordered. The display value (other than none) is ignored for flex or grid items.
I gave you an example of how to use the order property. If you only set one item to one then it will be ordered last as the non ordered items will come first.
Screen readers usually just read the html and not the css display. If the order of the html is important then keep it that way. I didn’t see any real significance to the order but if it’s important then keep the html structure.
Logical well structured html is always best for accessibility.
I want to add vertical line dividing left column from right column (see my first post screenshot). In my original solution I had those as two groups of flex items (4 and 4) wrapped in two divs. If I add a wrapper div to first four items and add border-right then display: grid would have no effect as they no longer direct children. What’s your thoughts on that?