Replies: 2 comments 3 replies
-
You can't pass the name from HTML to CSS, however, you can set the style on the element directly. With data bindings you could e.g. do |
Beta Was this translation helpful? Give feedback.
-
I will have a lot of different buttons and I want to create a generic button class with the different variants to support the button being disabled, clicked, hovered etc (with each variant having a different image). In the HTML, whenever I need a button, I just need to be able to create a Currently, I would need to create each variant for every button (specifying every image name variant) in CSS, which is a lot of combinations of the exact same code, with only the image name being different in every case. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to figure out the cleanest way to do the following in RML. I need to create some CSS for a generic "button" class (just a div). I want to be able to set the actual image name in HTML and have that be passed to the CSS. For each of the different states (hover etc), I want to use a modified version of the name. See below for an example of what I mean. TIA!
<div class = "mybutton" MY-IMAGE-NAME="blah">
</div>
// CSS
.mybutton {
decorator: image(MY-IMAGE-NAME+'.png')
}
.mybutton:hover {
decorator: image(MY-IMAGE-NAME+'-hover.png')
`}
Beta Was this translation helpful? Give feedback.
All reactions