1.Убедился, что файл .razor.css имеет то же имя, что и файл .razor, и находится в той же папке.
2.Очистил и пересобрал решение в Visual Studio.
3.Проверил включение стилей в index.html, добавив:
Несмотря на эти усилия, стили до сих пор не применяются. Мы будем очень признательны за любые предложения о том, что может быть причиной этой проблемы и как ее решить.
MyComponentBase.razor:
@inherits MyComponentBase
@foreach (var item in Products) {
@item.Name
@item.Price.ToString("C")
}
MyComponentBase.razor.css:
a {
text-decoration: none;
}
a:hover .card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
transition: box-shadow 0.3s ease-in-out;
}
.card {
transition: box-shadow 0.3s ease-in-out;
overflow: hidden;
}
a:hover .img-hover {
transform: scale(1.07);
transition: 0.5s ease-in-out;
}
.img-hover {
transition: 0.5s ease-in-out;
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... or-project