Question on the order of elements in an html document

A quick question on the sequence of html elements, lets say for example i’m building a landing page, i work on the header where i wan to place an image on the tog right, in the center i would have the heading and paragraph as a call to action.

would you need to respect the order of importance or can you write the html based on the where you want to position you elements as the image would be first would you place <img> first or would <h1> still be the first html element?

HTML is rendered in the order it appears in the file unless you change that via CSS. There is no “importance”, it’s just element1, element2, element3 and so on. Normally you should try write it in a logical order (like title, subtitle, text, etc etc), that way it is easier for a machine to read it (useful for multiple reasons including accessibility and SEO), then use CSS to move things around visually.

correct me if i am wrong in the example that i shared you should place h1 first?

:man_shrugging: it’s entirely up to you. If it is important that the image is first, put it first

1 Like