article element flexbox issue

Hi, so i'm trying to make this a flexbox with the h2 and p on the left and the image on the right but if i do this as it is, html validator yells at me saying that i need the h2 to be a direct child to the article element. How else am i suppose to group the h2 nd p within the article tags without having them in a parent div to make a flexbox? @Kevin <article> <div> <h2>lorem ipsum</h2> <p>lorem ipsum veteri ingnisei</p> </div> <img src= "/pathtoimage" alt= "some image"> </article>
12 Replies
glutonium
glutonium2y ago
share the css as well if u want the h2 and p on the left and img on the right using flexbox..u can do it as follows
<article>
<div>
<h2></h2>
<p></p>
</div>

<img src = "#">
</article>
<article>
<div>
<h2></h2>
<p></p>
</div>

<img src = "#">
</article>
article{
display: flex;
}
article{
display: flex;
}
this should work
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TheBuilder_
TheBuilder_OP2y ago
that's weird, I just ran another check and it seems to be fine it.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
glutonium
glutonium2y ago
html validation?? this is the first time I'm hearing this.. what's it about
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Jochem
Jochem2y ago
considering divs aren't supposed to have any semantic meaning, it makes sense that it would validate there's online validators that will check your HTML for structural issues, including the w3c workgroup one: https://validator.w3.org/
glutonium
glutonium2y ago
so if the structure is not correct then the html is invalid??
Jochem
Jochem2y ago
yes? browsers will do their best to turn even the worst garbage into a valid document, but it can cause unpredictable behavior
glutonium
glutonium2y ago
hmm i see gotcha..tnx
Chris Bolson
Chris Bolson2y ago
The only issue I can imagine coming up for an H2 is if there isn't an H1 somewhere before it.
glutonium
glutonium2y ago
HMMM
Want results from more Discord servers?
Add your server