I have this header formation and inside it, there is an image tag which is used as logo. Div there stands for as a flex wrapper to wrap image tag.
So I want to change that wrapper DIV into a tag so that it gets more semantic but is it good to use a figure element as a wrapper in header tag? It seems when I use figure tag it adds 40px margin too. So it seems it is not suitable for wrapping image as logo.
The figure element is probably overkill here and I wouldn’t use it in this scenario. Not all images need to be in figure. If the image has a caption with it then yes, use a figure. But usually the logo in the header acts as a link and it would be wrapped in an anchor element, so you definitely would not want to use a figure in that case.
If you do end up using it as a link then you’ll need to change the alt text so that it reflects where the link takes you, such as “Home page”.
Thank you so much. I replaced it with an anchor tag now.
Then I want to ask. Can I turn the anchor into a display:flex? Does this change affect the semantic meaning of the anchor tag because it is already an inline tag?