The following code snippet captures a sectionId that
points to the section wrapper that Shopify generates.

{%- liquid
 
    capture sectionId
        echo 'shopify-section-'
        echo section.id
    endcapture
 
-%}

+ CSS Variables

The sectionId can directly be used
to declare section scoped variables.

Tag

<style>
 
    #{{- sectionId -}}{
        ---Variable : {{- value -}} ;
    }
 
</style>

Inline

{%- liquid
 
    capture style
        echo '---Variable : '
        echo value
        echo ';'
    endcapture
 
-%}
 
<div style = '{{- style -}}' ></div>