L
L
Legioner9112015-02-15 17:31:14
css
Legioner911, 2015-02-15 17:31:14

Why are bootstrap's less mixins not working correctly?

Good day to all!
Good people from the toaster told me how to use bootstrap when developing a responsive site, without adding a bunch of classes to html( Is it possible to develop a site responsively without using a lot of classes? ) (thanks to them :) ). This is possible with preprocessors using mixins. But when I started testing this method, I ran into a problem that I can not solve for several hours.
Actually the essence of the problem:
There is a bootstrap.less file
There is my main.less file (in which it is imported @import (reference)"less/bootstrap.less";)
When adding a class to html, for example "col-xs-2", the columns are displayed normally
7cb54f292acf4b8eb2a085e90e705acf.jpg
But when adding an impurity to main.less, it is displayed like this
152a935e3ac645e8bf3bceddcaebe617.jpg
Code example

@import (reference)"less/bootstrap.less";
.container{
  background: #ccc;
  .article-row{
    .row;
    .article{
      .col-xs-2;
   // причём если сюда добавить ещё .col-md-2; то при компиляции вылазит ошибка
      background: blue;
      border: 1px solid #222;
      height: 200px;
    }
  }
}

I noticed when comparing that for some reason there is no float: left;. But as mixing can affect properties, I just mix it in main.less without changing anything.
In theory, everything should work the way it works when I add this class to html. But no... And besides, I cannot add two classes to the mix. In this case, I will not be able to configure the adaptation.
Comrades professionals, tell me what I'm doing wrong? And how to mix in several classes of the bootstrap grid so that there are no errors?
Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Ivanov, 2015-02-15
@nikstorm

Remember about important.

A
asdz, 2015-03-16
@asdz

Columns are made by mixins

.make-xs-column();
.make-md-column();
.make-lg-column();

why is col-xs-2 here? See less bootstrap files, everything is clearly written there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question