Method addCss() not working correct usage

Hello!! I'm trying to use addCss(). The case in question is for example:

webix.html.addCss("dom_element", "class_name");

The problem is that if i place the class declaration into the section of the main html page (i'm developing an one page webapp) the code specified above work but instead if i place the css class definition into an external css file (in this case placed into a subfolder but i tried with a file placed at top level) obiviously including it into the main html page, like this:

"< link rel="stylesheet" href="custom_css/customStyles.css" type="text/css" charset="utf-8" >"

The addCss() start not working. It seems that the definition become invisible.

Any idea?

Comments

  • Hello,

    The addCSS method just adds /appends a provided string to the node class name. And it does not where the corresponding CSS rule is declared, either it is document head or the included style sheet.

    <span class="added">
    <span class="own added">
    

    Please inspect the HTML with browser dev tools to ensure that the needed node has the defined CSS class and the stylesheet has been loaded.

  • Thank you Helga for your answer and sorry for the late but i was abroad in the last month. I tried to understand this phrase:

    "And it does not where the corresponding CSS rule is declared, either it is document head or the included style sheet."

    But I don't know what you mean can you explain me?.
    I'm sure that the css is loaded beacuse i use other custom css rules declared into for my webapplication but i don't know why if i place

    .third_state_bgcolor{
    background-color: #ffa357;
    border-radius: 5%;
    }

    into my custom css file (or other loaded css files) addCss() doesn't work and instead if i place the same css rule between tag in the head of index.html (i developed a one page application) addCss() method work.

    Maybe i maked a stupid mistake but is strange. if you assure me that addCss() should work with a rule placed in any css file in any place in the application and loaded via usual < link rel="stylesheet"> html tag and i don't pay attention "to anything" (some particular policy or characteristics of the framework) i'll try to find the problem.

  • @francesco_talin
    addCss / removeCss is agnostic about your styles.
    they just add or remove provided string (css class) to or from node's className.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!