How to preserve styles of embedded widget?

前端 未结 5 1090
我寻月下人不归
我寻月下人不归 2021-01-05 11:39

How to make an external PHP widget page have its own CSS. The catch is - when the external page is included it\'s been affected by the stylesheet of th

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 11:55

    Try surrounding your widget code in a div with an id. Then prefix each CSS selector used in the widget with that selector.

    ex.

    instead of,

    .nav{
    // styles
    }
    

    do

    #widget.nav{
    // styles
    }
    

提交回复
热议问题