Hi!
This issue started when I wanted to add some paddings to a div, that did not showed up on the front-end the same way as they did in the Layout builder.
I have decided to add visible borders to all containers inside looped columns, to understand what is going on. My findings are that it seems to be a bug with a DIV when it has an <a>
tag.
This is how the products look like in the Layout builder:
This is the front end:
As you can see, the paddings are not working.
Now, this is my structure for the Looped column:
Since it is not possible to have both the <article>
and <a>
tag on the same container, I have decided to nest them. <article>
is for the semantics, and <a>
is to make the content inside the column clickable.
When we add visible borders to all containers, we get this inside the Layout editor:
Red: Column
<article>
Blue: Div
<a>
Orange: Div
<figure>
Green: Div
<article>
that holds all the product data
The paddings that are not applying on the front end are added to the blue div with the <a>
tag.
However, this is what happens on the front end:
As you can see, we don’t have a single <a>
blue DIV that wraps around the figure and the nested (green) article anymore. We have the blue <a>
DIV now repeated two times: One is around the <figure>
DIV, and the other got inside the second, green <article>
DIV, that is nested inside. So the front-end structure is not the same as the back-end one, and that probably causes the paddings to fail to be effective.
Thanks!
Edit: When I make the outer Column to be have an <a>
tag, and the inner div to have the <article>
tag, so switching the tags on the red and the blue container, the problem goes away. Still, it seems that the div with an <a>
tag misbehaves in some scenarios, like the one I have encountered.