Div with external stylesheet?

后端 未结 8 1793
灰色年华
灰色年华 2020-12-10 13:19

I have been given an external stylesheet (.css file) that may not altered in any way whatsoever. However I need to apply this stylesheet to a single div and therefore the co

8条回答
  •  轮回少年
    2020-12-10 14:14

    If you have access to server-side scripting (eg: PHP), you could create a script that loads the external stylesheet, and appends a class name in front of every entry. Then apply this class to your DIV tag. So, if the CSS includes:

    p { font-size: 12px; }
    

    You'd modify that to:

    .mydiv p { font-size: 12px; }
    

    And format your DIV as

    ...

    You would then load the script as a stylesheet, rather than the external stylesheet directly.

    
    

提交回复
热议问题