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
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
this should work
Doesn't solve the html validation problem though...
Though I've just run it through the w3.org validator and it doesn't bat an eyelid
that's weird, I just ran another check and it seems to be fine it.
I was dubious about it when you first mentioned it tbh
html validation?? this is the first time I'm hearing this.. what's it about
Read op's question again
Though it seems to be a non issue which makes sense to me
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/
so if the structure is not correct then the html is invalid??
yes?
browsers will do their best to turn even the worst garbage into a valid document, but it can cause unpredictable behavior
hmm i see
gotcha..tnx
The only issue I can imagine coming up for an H2 is if there isn't an H1 somewhere before it.
HMMM