Solved

Bootstrap 3 - different number of fixed width items depending upon screeen width

Posted on 2015-01-02
3
243 Views
Last Modified: 2015-01-03
We have a website designed using Bootstrap v3+

We want to have on a particular page a number of fixed width <div> or <img>

How many we can display naturally depends on the width of the screen.
The page content will be wrapped in a <div class='container-fluid'>

So if each <div> or <img> is fixed at 200px wide...
 - on a 960px wide screen = 4 blocks could be displayed
 - on a 1200px wide screen = 5 or 6 blocks could be displayed (depends on the margin between each block)
 - on a 1480px wide screen = 7 blocks could be displayed

Just cannot work out how to do this in Bootstrap as everything in there is fixed columns and you need to know how many columns you want. I don't know how many columns I need. Also would like this to be flexible enough, so that if I need to change the blocks size, everything just works itself out.
0
Comment
Question by:Sean Clarke
  • 2
3 Comments
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 40528559
you dong have to use bootstrap columns. just use float:left on all the fixed width containers.

for example:

<div class="my-container">
  <div>foo</div>
  <div>bar</div>
</div>

.my-container > div{
  float:left;
}

how many inner divs fit across will depend on the with of the container
0
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 500 total points
ID: 40528561
sorry, typing on phone...

dont be crippled by bootstrap. just because you have bootstrap doesnt mean every single element on your page has to be determined by bootstrap classes
0
 
LVL 1

Author Closing Comment

by:Sean Clarke
ID: 40528960
Kyle, blinked by Bootstrap - Indeed, just needed to go back to basic CSS

.mydiv { float: left; width: 135px; height: 155px; overflow: hidden; margin: 0px 10px 10px 0px; }
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Page Speed Insight with srcset 4 91
edit .asp files 5 31
Company website 6 30
Check ALL SP in database make sure there are no errors 17 45
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question