Reputation: 45
I have declare a class in my site.css file as follows:
.CMenu1 {
display:inline;
}
Then I have tried to use that class to style my list in Index.cshtml like so:
<ul class="CMenu1">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ul>
However when I run the solution it continues to show the default style for a list, why?
Upvotes: 1
Views: 1319
Reputation: 1
class is already a built in property in c#, so in order to make that read you need to put
@class
:
<ul @class="CMenu1">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ul>
Upvotes: 0
Reputation: 1270
Anyone looking for a solution to a problem other than what OP have asked for -
Sometimes the class is not added to the Site.css
even after rebuilding the project. The problem here is that Site.css
is not getting updated in the project even though we have modified it. In this case, clean
followed by rebuild
or build
would do the trick.
Upvotes: 1
Reputation: 8475
You need to apply the css to the <li>
elements to make them inline.
.CMenu1 li{
display:inline;
}
<ul class="CMenu1">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ul>
Upvotes: 1