Load an external CSS for a specific DIV

后端 未结 4 1435
礼貌的吻别
礼貌的吻别 2020-12-14 21:25

So basically I have a page that has it\'s own CSS. On my server I have a folder of different CSS style files, so I want to have a \"preview\" window on my page for them. Can

4条回答
  •  温柔的废话
    2020-12-14 21:56

    CSS applies to entire documents.

    If you want to limit the scope, then you need to make use of a descendent selector.

    e.g. #id_of_div .the .rest .of .the .selector {}

    You have to apply this to every selector, and take into account groups (so it isn't as simple as just prefixing the whole stylesheet and suffixing every })

    You would also find the stylesheet for the main document applying to your preview.

    A frame would probably be the best approach to solving this problem.

提交回复
热议问题