How Can I Put Multiple Classes In A
I am working with a navigation menu, and wondering how to put multiple classes in a li tag: This is the li tag And this is also what I wa
Solution 1:
You can add multiple classes to an element by putting them all in the same class attribute and separating them with a space. For example:
<li class='pil dropdown {{ ($aktiv == 'dagvakt') ? 'active' : '' }}'>
As far as I know, the spec only allows class to be declared once, so trying <li class='ex' class='am' class='ple'> won't work.
Solution 2:
Only one of each attribute can exist at one time, it should be a space-separated list of classes. Try this:
<li class="pil dropdown {{ ($aktiv == 'dagvakt') ? 'active' : '' }}">
Also careful using quotes ' inside quotes, it's a good idea to use double quote " to assist syntax highlighting and to avoid any conflicts.
Post a Comment for "How Can I Put Multiple Classes In A