Jump to content

Dynamic CSS


mortalc

Recommended Posts

Can CSS keep up with changes?For example, I have a paragraph with className "red". I have a button which when clicked will change the className to "blue". If in my CSS it says that things with className "red" should be coloured red, and things with className "blue" should be coloured blue, will the text change colour on the click of the button?

Link to comment
Share on other sites

if you did it correctly it should. have you tried something that is not working like you expected?edit: I assume you mean that you are changing the class name using javascript...

Link to comment
Share on other sites

I tried it quickly in the "try it yourself" editor, and it didn't work. But I know that it's not a proper editor.But come think of it, I wrote a complicated webpage which seemed to work on it but not in reality... but I believe I know why, so it is irrelevant.Sorry, I'm rambling. I wrote a code for which it didn't work, and I wanted to make sure that it was not that but something else that was going wrong. Thanks!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...