Reputation: 9
HTML:
<div class="row">
<div class="test">
<h1>test</h1>
</div>
<div class="test">
<h1>test</h1>
</div>
</div>
CSS:
.test
{
background-color: #000;
.col-md-2;
}
where class test try to referencing the class col,but it's not working.
Bootstrap allows reference classes from another classes ?
I used following article to guide me:
Upvotes: 0
Views: 49
Reputation: 12870
Without SASS, Bootstrap is setup to use class definitions in the HTML to define the grid. It allows you to better visualize the grid when you're doing structural maintenance.
HTML:
<div class="row">
<div class="test col-md-2">
<h1>test</h1>
</div>
<div class="test col-md-2">
<h1>test</h1>
</div>
CSS:
.test { background-color: #000; }
BTW, out of the box, a black background div with default text would be black-on-black....so you'd never see your text...
Upvotes: 1
Reputation: 11013
In CSS you cannot nest classes, you need to use SASS or LESS to create these nested class calls:
Example using SASS:
.test {
background-color: #000;
@include make-md-column(2);
}
Upvotes: 1