Stop CSS styles to be applied in particular sections of the code

前端 未结 4 831
眼角桃花
眼角桃花 2020-12-11 20:14

This question may sound a bit weird/novice/stupid. Please bear with me.

The below code is a small portion of a webpage I have created using CSS, HTML and coldfusion.

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-11 21:00

    HTML5 allows scoped stylesheets, but only Firefox supports it so far. There is also a polyfill JavaScript.

    Therefore, you'll have to adapt your markup and styles so that it only matches part2, and not part1. In a pinch, you can precede every selector with #wrapper. For example, if a rule says a{color:red}, substitute that with #wrapper a {color:red;}.

    By the way, part1 should probably be a child of instead of .

提交回复
热议问题