Recently, I came across a solution to change the CSS for the body element in a specific view using a layout. Here is what I found:
At the top of my view, I added this code snippet:
@{
ViewData["PageId"] = "Login";
}
The corresponding CSS looks like this:
body#Login {
padding-top: 0;
background: #000428;
background: -webkit-linear-gradient(to left, #004e92, #000428);
background: linear-gradient(to left, #004e92, #000428);
}
However, when I attempted to modify the CSS for the html element as well by adding the following code, it didn't have any effect:
html#Login {
overflow-y: auto;
}
I'm curious to understand how this mechanism works and why there cannot be any space between body
and #Login
.