Copy Button class so I can modify it?

Hi - I am trying to use an existing Button1 class as a template for creating a new button class (Button2). I do not want the new Button2 class to change the behavior/position etc of the original Button1 class. How do I do this? Thanks!

You should start with your basic properties set as “button”, then surcharge that by adding an extra class “button2”.

“button, button2” will keep everuthing set for “button”, adding new and overrrided properties set for “button2”.

So in your case, you can, you just have to keep the button1 class and add a button2 class. Wich results in “button1, button2”.

Thanks Vincent. I am doing this now for my classes. I was hoping I could just copy Button1 and use what I want for Button2 - it may be I don’t want everything in Button1 + some new properties added. I want to subtract some properties out of the Button1 class and add some new ones, but it seems the only way to do this is the way you describe. Thanks again.

The way he describes, using a nested class, IS the right way to do this. This is the way CSS works. Anything in the nested class that you don’t modify, takes on the parent class’s parameters. So it is exactly what you want. I use this to modify buttons all the time having the Button class set to the way they should look and then do nested classes to change the size or whatever I want to change as necessary. Good Luck!

Thanks! I’ve been using it this afternoon this way and it works well for me. I just have a lot of nested classes, but I guess that’s okay. Thanks again.

It’s totally OK, it’s supposed to work like that. If you feel bad the way you use your classes, go check the code of pages generated by popular CMS like Drupal… You’ll feel super great about your work and how Webflow generates the code.

1 Like

That’s good enough for me Vincent. Thanks again for your guidance here.