I have this thing on my web page ... I think it could be called widgets ...
How to separate its CSS and JS from the contained CSS and JS page? preferably without using an iframe?
In my application, the user can customize the CSS of the content, so I need a clean list.
In the outermost element of your widget, set a relatively unique class name. For instance:
<div class="my_spiffy_widget"> <!-- Insert spiffy widget here --> </div>
Put Javascript and CSS in your own files. For CSS, create all your selectors as follows:
.my_spiffy_widget P { /* paragraph rules */ } .my_spiffy_widget A { /* anchor rules */ } .my_spiffy_widget UL { /* unordered list rules */ }
This ensures that your rules are not accidentally overridden by other CSS rules.
JavaScript :
function my_spiffy_widget_doSomething() {...}
, , :
var my_spiffy_widget_firstTime = true;
, .
:
div.widget #header { padding-left: 10px !important; padding-right: 5px !important; }
/ CSS reset script (, Eric Meyer's) DIV.
css , , (, "KAFHxyz _..." ). , "".
, CSS !important ( "body {font...}", .
!important
javascript, , "" ( JS/CSS), reset , . , , , .
[] , , iframe JavaScript (DOM ) , ? IFrame Div-like, " " CSS JS.
iframe
Source: https://habr.com/ru/post/1753346/More articles:Partially initialize a variable defined in another module - c ++Как создать графический интерфейс java с интерфейсом IDE с использованием "интерфейсных сборщиков"? - javaHow to map application resource key in display titlekey tag? - struts2Как удалить пространство значков после свойства null SmallImageList списка ListView - listviewhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1753345/applying-jquery-event-handlers-to-ajax-content&usg=ALkJrhgjUAIRPuEQbwtNjzvqzuYLv5I95QChange the LDAP attribute of PhoneNumber and IPPhone using C # - c #Deserializing ArrayList from non generic type using GSON - androidReading XML, replacing text, and writing to the same XML file through Java - javaStop SQL Server Useless Evaluation UP / DOWN WHERE? - sql-serveriPhone: how to check if UIApplicationExitsOnSuspend works? - iphoneAll Articles