How can I style a Liquid block with CSS?

Hi everyone!

I am trying to add category tags to our product pages, via a Liquid block on the product page template.

I’ve used the following code:

{% for tag in product.tags %}
  {{ tag }}
{% endfor %}

It works, the tags show up properly - now I would just like to style them with some CSS.

(Color them, give them some background & edging - actually, very similar to the label tags on this page here):

Screen Shot 2022-11-09 at 9.11.30 AM.png

Can I do this directly in the liquid block via CSS? Or do I need to edit a theme or css file somewhere else?

(Ideally it would be just on product page in this use case, as that’s the only place we’re going to be displaying them)

Thank you!

Hello @pb9 ,
Please share your website URL

Hello - none of this is live on our site yet, we’re just tinkering on the backend to see if we want to add it live after we get it styled.

We’re using the Pipeline theme, if that’s what you’re after

You can share preview URL with us.

It doesn’t let me share preview without saving in editor, but we only really need help with the top right liquid block in the corner. How do we apply CSS there? (Or can we not?)

(You can see the ‘unfinished’ product tags - comedy, romance - are displaying properly, we just want to style those)

Hi @pb9 ,

Please change all code:

{% for tag in product.tags %}
    

        {{ tag }}
	

{% endfor %}

You can change the color code to your liking.

Hope it helps!

1 Like

Exactly what we were looking for, thank you so much Litos!

1 Like