Trouble using Spacing field to give to your own module
SOLVE
I have created my own heading module using the following code. However, the following problems occurred
1) Placing this heading module in multiple pages as drag-and-drop content. (2) Margin is given to each heading, margin-top:40px for the first, margin-top:60px for the second, and margin-top:80px for the third 3) Since the margin space field is used for the selector named .c-general-heading, it is overwritten as shown below, and it is not possible to give different margin-tops for each module. How can I give a dynamic spacing number in the spacing field to a selector, is it down to some module-specific id or something? Where can I look to solve this?
Add a logic > choice module called "margin_top" that spits out c-general-margin-40, c-general-margin-60 or c-general-margin-80 as an ID depending on your choice, then you can have styling for 3 different ID's
Add a logic > choice module called "margin_top" that spits out c-general-margin-40, c-general-margin-60 or c-general-margin-80 as an ID depending on your choice, then you can have styling for 3 different ID's
Trouble using Spacing field to give to your own module
SOLVE
I see, thank you very much. However, this is only relevant for the top margin, and in fact the style panel allows both 4-cornered margins and padding to be selected, right? I don't think it is necessarily only about the margin tops. In such a case, how can I specify the selector so that if I have multiple unique modules on the same page, they can each have different margins and paddings and not overwrite each other? Is there anything in the boilerplate, for example, that replicates this? I would like to see a sample if you have one.
Trouble using Spacing field to give to your own module
SOLVE
An alternative solution, if you want to be able to control the Margin and Padding from the front end, rather than manually editing the CSS file through the design manager.
You could create a text module called header_id. Then you switch the class over to an ID, then modify the code slightly as per below. Now, every time you use the module, make sure to give header_id either a unique id or use one already used on the page to use the same padding/margin.