Is there a way to dynamically change content without javascript?

后端 未结 3 1808
温柔的废话
温柔的废话 2020-12-18 10:42

I am building out a page for work that has a section where the content needs to change dynamically on button(s) click. I know of several different ways to accomplish this bu

3条回答
  •  甜味超标
    2020-12-18 11:44

    I don't think there is any way to directly modify the content with CSS, because as its name suggests, it is specifically for style. I don't know of any tricks, sorry. I don't think CSS is actually an appropriate way to do this, because it is not good code organization (although web is not known for good code organization anyway). It should be really simple to bang out the javascript, so I recommend just doing it yourself if at all possible. Changing content with a button press really isn't a difficult javascript problem. Throw in some jquery, and you can get slick transitions, too.

    HTML is not designed to be dynamic, it's simply a document format, more or less. I don't think CSS was designed for much dynamism either, just changing styles on certain events. So I think because changing content is not changing style, it is either not possible, or not a very pretty way to do it.

    Good luck!

提交回复
热议问题