How can it be ignoring my style in the div it is assigned?

David Thielen 3,211 Reputation points
2023-05-02T19:54:34.3833333+00:00

I'm seeing some other css not getting applied form the auto-generated css file. So I think something is wrong in what Blazor is doing. But the auto-generated files does exist, is correctly linked to, and has the expected content.


This is all part of a Blazor app using DevExpress and so creating a MRE is impossible as there are 108 included CSS & JS files. With that said, the issue is very straightforward.

The underlying HTML of interest is:

<div class="my-main-scrollbar">

the underlying CSS of interest is:

.my-main-scrollbar {
    overflow: auto;
    height: 100%;
}

When I open F12 and select the above <div> and then look at combined - there is no value set for overflow or height. They are not being applied.

The generated HTML (view page source) is:

<div class="my-main-scrollbar" b-jv8gxb7csr>

And the generated css is:

.my-main-scrollbar[b-jv8gxb7csr] {
    overflow: auto;
    height: 100%;
}

This is due to Blazor creating the css on the fly from the file MyPage.razor.css.

Any idea why in this case these CSS settings are not being applied?

thanks - dave

Developer technologies | .NET | Blazor
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.