Javascript 我能在更少的文件中实现自动调整大小吗?

Javascript 我能在更少的文件中实现自动调整大小吗?,javascript,css,twitter-bootstrap,less,Javascript,Css,Twitter Bootstrap,Less,我有这门课: .tab-content a.button { .round-borders(0px); } .tab-content a.button:first-child { .round-borders-only-left(); } .tab-content a.button:last-child { .round-borders-only-right(); } 我想要达到的目标。如果有两个元素,它们应该适合大小相同的行,因此可以使用扩展。col-md-6 如果有3个,使用

我有这门课:

.tab-content a.button {
  .round-borders(0px);
}

.tab-content a.button:first-child {
  .round-borders-only-left();
}
.tab-content a.button:last-child {
  .round-borders-only-right();
}
我想要达到的目标。如果有两个元素,它们应该适合大小相同的行,因此可以使用
扩展。col-md-6

如果有3个,使用
.col-md-4
,如果有4个,则使用
.col-md-4
,进一步使用12/个选项卡内容子项计数,四舍五入到最小值(12/5=>2)

编辑

<div class="tab-content">
<a class="button col-md-12" href="/programs/12/streams/new">Добавить поток</a><a class="button col-md-12" href="/programs/12/courses/new">Добавить курс</a>
</div>

例如,我有这个
div.tab-content
和两个
a.button
子项。现在,我需要手动将
col-md-12
(我使用24列网格系统)应用于每个元素,使它们的大小相同并填充父div

是否有任何方法可以将其定义为更少,并自动应用,假设它可能是自动生成的2、3、4或更多(作为rails视图模板代码的一部分)


可以用更少的文件完成吗?你能举个例子吗?

我不确定我是否理解你的要求。你有什么html来帮助澄清吗?在
css
中,你可以使用
.class+.class{//Apply some style here}
,这样也许在
中也可以用
less
。@ViperCode,我编辑来澄清哦,好的,我想我明白了,您希望自动将col md XX应用于代码,并始终使它们具有相同的宽度并填充父级?@ViperCode,完全正确。我想知道,如果没有简单的javascript,通过css.less,它是否可以实现