how do I represent this properly in the dom

I am thinking of using a table but it sounds very bad in my head; I also ran into some issues I don't like while using flex box
No description
21 Replies
b1mind
b1mind•7mo ago
Why not Grid 🥲
yuki_toki
yuki_tokiOP•7mo ago
I'm not that good with grid But I think it could work Grid template areas then fill in the spotd?
vince
vince•7mo ago
I feel like semantically this should be a table that you can style with grid probs
Jochem
Jochem•7mo ago
wouldn't this semantically be a bunch details tags in a ul?
vince
vince•7mo ago
Hm... I was thinking that general and joining process would be the column headers and then you could have details in the tr? I'm assuming that the FAQ questions are dropdowns / details
Jochem
Jochem•7mo ago
I don't think this is technically tabular data it's a nested list General also describes the type of question it is, instead of being a label for a data column
vince
vince•7mo ago
I can see that, I'll have to read the spec to see what exactly constitutes as tabular data now haha
yuki_toki
yuki_tokiOP•7mo ago
But then using a details and a nested list, how do I get the first column to be all on the same line, without affecting the alignment of the rows on the last column
Jochem
Jochem•7mo ago
with grid
yuki_toki
yuki_tokiOP•7mo ago
Okay I'll look into grid Thank you
vince
vince•7mo ago
I'll try to make a codepen for this later tonight too after work if you're still stuck, ping me if you don't get a response by ~7 PM EST
yuki_toki
yuki_tokiOP•7mo ago
I'll try to work on it with grid I have an idea in mind, had to step out Thanks Vince
yuki_toki
yuki_tokiOP•7mo ago
i got the general layout; just trying to style it. I think i can handle from here. Thanks
No description
yuki_toki
yuki_tokiOP•7mo ago
used grid-template-areas and grid area
vince
vince•7mo ago
I was looking at those thing grey lines, how do you handle those? I was thinking that could be tricky Psudoelements maybe?
yuki_toki
yuki_tokiOP•7mo ago
ill have to research what these are only familiar with hover i was thinking of adding the borders everywhere but now that i think about it, it wont cover the grid areas that are empty
vince
vince•7mo ago
I think you could use something like ::after or ::before and basically have it span all grid columns:
.element::after {
grid-column: 1 / -1;
}
.element::after {
grid-column: 1 / -1;
}
Not sure how well that would work / if it would be the best way though Your .element here could be your questions maybe
yuki_toki
yuki_tokiOP•7mo ago
okay i will try this, thanks
vince
vince•7mo ago
I got a rough prototype here: https://codepen.io/vince1444/full/bGyeZKm I really don't like this solution though so if anyone has some suggestions please feel free! I'm actually confused on how my width: 200% was able to fit perfectly with no overflow 😅
yuki_toki
yuki_tokiOP•7mo ago
looks way better than mine for sure lol
salentipy
salentipy•7mo ago
Looks like you're going with grid to style? If you need something semantic for the <html>, you could try the <dl> <dt> <dd> tags. They're really good for lists with definitions or descriptions like this. I put together a little Codepen, so you can see how they handle themselves just from the <html> alone. https://codepen.io/salentipy/pen/yLWaLjW?editors=1000 More info here: https://www.w3schools.com/TAgs/tag_dd.asp
Julie
CodePen
DL, DT, DD
...
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
Want results from more Discord servers?
Add your server