Hello! I want my plugin to create HTML element with width, specified by plugin user. The logic is:
- User type a width in a custom codeblock, ex.
width: 100px
- My plugin read this string and pass it to createEl(), now it looks like:
const row = el.createEl('div', { cls: 'segments-row', attr: {
'element-width': width
}});
- CSS class reads the attribute and sets it as width:
.segments-row {
--element-width: attr(element-width);
background: transparent;
display: flex;
justify-content: center;
gap: 1%;
width: var(--element-width);
height: 20px;
margin: 10px 20px;
}
Something is wrong with this steps, because width of my element still looks like auto. Newbie to HTML/CSS here…