1

I want to have my own markup

<nav>
<my-list class="nav-justified">
    <item class="nav-item">Text 1</item>
    <item class="nav-item">Text 2</item>
</my-list>
</nav>

I cannot do that right now because bootstrap is targetting LIs inside by the element name only and not by a class

for example

.nav-justified {
  width: 100%;

  > li {
    float: none;
    > a {
      text-align: center;
      margin-bottom: 5px;
    }
  }

any ideas?

DS_web_developer
  • 3,622
  • 13
  • 52
  • 83

1 Answers1

1

In your case, you have to add some CSS or change existing one.

As I'm using SASS a lot, I was thinking about extending a class/selector — but as you are using LESS you need the equivalent :extend(.class)-method.

So you could just add another LESS-file in your project and in there set up your markup and extend the existing Bootstrap-Styles:

my-list:extend(.nav-justified) {...}

.nav-item:extend(.nav-justified > li) {...}

(something in this direction, depending on your needs // code is untested)

By extending the existing selectors and working in a separate file your project should stay clean and you could re-use your work in other projects where you use Bootstrap.

More about the LESS extend feature

Community
  • 1
  • 1
Sebastian G. Marinescu
  • 2,374
  • 1
  • 22
  • 33