OS11 - webblock css not only limited to that webblock

OS11 - webblock css not only limited to that webblock

  

Hi,

We have a webblock with some css:

.RowWithAddAction{
    display: none;
}

We just found out that this impact everything on the page with this class instead of limiting to only the content in the webblock.

Hello freek,

If I am not mistake, this is the normal behavior.

The reason is that the CSS of a web block is stored in a file and loaded in the HEADER of the page where that web block is used. As so, if the selectors used in the web block CSS match any element outside the web block, this style may be applied outside the web block.

In order to avoid this, be sure to use selectors that reduces the chance of occur a matching for elements outside the web block, like for example put all the content in the web block inside a container with a class and use selectors like this one:

.MyWebBlockClass .RowWithAddAction{
    display: none;
}

Just an idea.

Cheers.

Hi,


It makes sense since from the standpoint of HTML it is just one page and it is loading the CSS files, in other words, HTML page does not know that the page has web blocks or not.

Based on the re-usability purpose of the web block, its CSS is the "least" strongest and it will be overridden by other CSS files like the web screen or the page, if of course, the CSS files address the same selectors.

Ah alright, I was in the believe that in the previous version this was working differently. Thnx for the reply.