asp attribute span not getting styled like plain span
Why is it that only the plain span is being styled and not the asp span? How can I fix this?
19 Replies
what does it look like in dev tools?
This is what the asp span is being rendered as in the browser
It's also happening when I try to style a regular button tag by applying a class to it (I put the styles in wwwroot/css/button.css and link it in the _Layout.cshtml file)
The only style that is currently being added to the button is the style I have for .button:hover, and not .button
It's probably just that something is wrong with your css selector. When you select the span in dev tools, what does the styles tab look like?
the ASP is compiled server side, the CSS is client side.
Which style is being applied? background green, backgrund yellow, or neither?
No styles are being applied to it at all
Only to the plain span, which gets a green background
show the styles tab in dev tools
what styles are actually being applied to the span you're having trouble with
This is all that's showing when selecting the asp span
have you cleared the cache? Hit control+f5 a bunch of times?
I can try, but I already changed machines
Can you see the stylesheet with that style in the dev tools
Seems like it's adding its own modularization technique at the end of the class name
How am I supposed to select this span
It seems like the modularization thing is only applied to cshtml.css files, which is why it works to style the field-validation-error class in wwwroot/css/site.css for example and not in the Form.cshtml.css
The asp span isn't getting the [b-crk0b8nylx] attribute applied to it, only the plain span does...
must be an attribute somewhere to force it to be added
ngl I don't typically do things this way myself, so haven't had to deal with this problem
How do you usually do it
Not page-specific stylesheets like that anyways as that makes it quite difficult to maintain a consistent theme throughout an application. Now bear in mind I've been doing enterprise stuff for most of my career, so MVC4/5 and some core web stuff.
Now you do have to have some page-specific styles, but I try to limit that as much as possible.
I wouldn't say I'm married to having page specific styles, so how would you do it? The project will only have 2-3 pages
I'd just put it into wwwroot/css/site.css
How about when there are a lot of styles, would you put it in folders under wwwroot/css?
or in multiple files rather
Yes, multiple files.
If there are multiple modules, create a subfolder and place the stylesheets in there.
Alright, thank you