bootstrap 一排5个_如何将Bootstrap行分成5个相等的部分?

I want to divide bootstrap row into 5 equal parts. It includes 12-col-md, so how i can divide it into equal 5 parts?

Can anyone help me to solve this problem?

解决方案

A great way to resolve this is here!

By default Bootstrap does not provide grid system that allows us to create five columns layout, but as you can see it’s quite simple.

At first you need to create default column definition in the way that Bootstrap do it. I called my classes col-..-15.

.col-xs-15,

.col-sm-15,

.col-md-15,

.col-lg-15 {

position: relative;

min-height: 1px;

padding-right: 10px;

padding-left: 10px;

}

Next you need to define width of new classes in case of different media queries.

.col-xs-15 {

width: 20%;

float: left;

}

@media (min-width: 768px) {

.col-sm-15 {

width: 20%;

float: left;

}

}

@media (min-width: 992px) {

.col-md-15 {

width: 20%;

float: left;

}

}

@media (min-width: 1200px) {

.col-lg-15 {

width: 20%;

float: left;

}

}

Now you are ready to combine your classes with original Bootstrap classes. For example, if you would like to create div element which behave like five columns layout on medium screens and like four columns on smaller ones, you just need to use something like this:

...

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值