I'm using Bootstrap3 for creating pages in my application.
Somewhere deep in a page I have the column (col-md-6), which width is calculated by percentage. My current goal is to fill that element with a set of child elements, respecting following rules:
If we use fixed values (in px), the task becomes pretty easy. Like here http://jsfiddle.net/vUEYG/
But I have no idea how to solve it with percentage values. I mean, ok I can add some wrapper element with width equal to N*100% (where N is the number of child elements). But then the question is how to set width of child elements to those 100%? :)
Could someone give an advice?
Thank you
If I have understood your requirements, I believe you can use flex-box to achieve this.
Note that there is no bootstrap used to achieve this, just straight css. If interested, there is a rather thorough breakdown of flex-box here.
#mask {
display: block;
height: 100px;
width: 100%;
overflow-x: scroll;
}
content {
display: flex;
align-content: flex-start;
width: 200%;
height: 100%;
}
content > div {
flex-grow: 1;
height: 100%;
background-color: #f00;
border: 1px solid #fff;
}
<div id="mask">
<content>
<div></div>
<div></div>
</content>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With