1

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?

3 Answers 3

1

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>

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

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>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.