Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
StyleSheetMain.css というサイト全体のメイン css ファイルがあります。独自の style.css ファイルを持つスライダーをダウンロードしましたが、いくつかの項目で競合があります。スライダーの css ファイルのスコープを、スライダー項目のみを含む div に限定したいと考えています。この CSS を外部に適用したくありません。スライダーdiv。任意のアイデア?ありがとう
CSS Grouping / Nesting を利用できます。
たとえば、次のものがあります。
<div id="main"> <div id="slider"> </div> </div> <div id="newslider"> <div id="slider"> </div> </div>
2 番目のスライダーのスタイルを変更するには:
#newslider #slider { background: #fff; }