I'm currently having a problem trying to set to the left every sublist of the navigation bar so that it aligns correctly bellow every sublist if there is more than 6 columns, the problem happens from the 7th list. I'm using bootstrap and every sublist have a size of 2 (so from the 7th as it passes the 12 column size it moves down, as expected)
What I'm getting a result is
And the expected result is
Piece of code used per list:
<div class="sub-navigation-section col-md-2">Ul and li inside</div>
The CSS that is attempting to do the expected result is a Float:left;
Bootstrap uses a 12 column grid system so you won't be able to divide that up equally into 7 columns. You could do this by creating your own class that has a width of approx 14.285% (100/7) and the same properties as the bootstrap col-* classes (float left etc)... but remember you'll need to cater for different viewports etc
If you wont use javascript, you can alternatively use CSS3´s column-gap and column-width like in this example:
https://www.bootply.com/118335
It floats the boxes like waterfall layout. Hope this helps you.
Related
For a printable layout I want to display a dynamic list (coming from an array) that should 'flow' through 4 columns of different heights, to look like this:
The blue elements are the four columns with the list (ul) inside.
The heights of the blue columns are fixed.
How can I achieve this with CSS? I looked at multicolumns in css but there the columns have to be the same height so that's not working I guess.
What's the best way to do this? It's fine if it only works in current web browsers.
I checked out 'flexbox' as well as 'css-grid' and even though it may be achievable I resign from doing it.
Instead I took another way and changed the initial array in the way I can comfortably place it in the different (now not connected) DIVs.
I have this code, with border bottom in every row.
https://jsfiddle.net/brygom/0z582swx/3/
For some reason the border bottom of row not complete all row width. Even if i don't use overflow-auto the border not completed.
The problem is that you are forcing to use 13 .col-2 inside a unique row. In Bootstrap this is not possible because a row has a maximum size of 12, so if you want three equal-width columns across, you can use .col-4, if instead you want two equal-width columns across you can use .col-6. Here you can se in detail how the bootstrap grid system works.
If you try to substitute .col-6 to .col-1 infact, you can see that the width of the line increases. The problem is that you have 13 columns and so I think that using the Bootstrap grid system is not the better choice.
If you want to create a table I suggest you to use the Bootstrap table, in this way you can add as many columns as you want with your preferred customized style. (here you can find the documentation).
If you want to customize better the table you can use instead a normal <table>.
I have an unordered list that contains several list items, split into 4 columns - Image below.
I'm having trouble getting the list-items at the upper level - The ones that have the images next to them in the image example - to break the column and start at the next column if they would otherwise overlap.
I've tried setting CSS attributes on each of the UL elements throughout the CSS, such as:
-webkit-column-break-inside:avoid;
-moz-column-break-inside:avoid;
-webkit-column-break-inside:avoid;
-o-column-break-inside:avoid;
However, nothing seems to change. I thought this was the style that would control this, but I must be wrong.
What I'm asking, specifically, is how I can prevent the contents of a list-item from wrapping to the next column in an unordered list.
I realized while attempting to create a sample for review, that the issue was only occurring for me in Internet Explorer.
Adding the style 'break-inside:avoid;' corrected the problem in that browser; it appeared the issue was not present in the browsers that were covered by the other styles.
Bootstrap's grid system is based on a 12-column layout, and in the current version (3.3.5), "if more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line."
However, I'm updating a site that uses an old version of Bootstrap (2.3.2) and the docs don't mention anything about column wrapping. Can I rely on the same column wrapping behaviour with Bootstrap 2.3.2?
Surely also in BootStrap 2, if you try to put more than 12 columns in a single row, elements wrap but with left margin starting on second row. The behaviour is the same because both are based on float:left positioning
Is there a way to create a dynamic CSS for 2 columns? What I mean is, there are 2 columns in my webpage, the left and right column. It is similar to Facebook, where the profile picture is the left column and the right column is where your feeds are located. When a link is selected from the left column, without refreshing the page, the right column will display the page automatically. The left column is where my links are located and it is fixed. The only change factor is my right column. How can I create and apply the CSS?
You don't need a CSS template in order to use columns. All you need to do is set your column widths to percentages instead of pixels. If you're using a three column grid, with one div taking one column and the other spanning two, then the percentage for the first column would be 33.3333333% (don't bother rounding up, the browser will take care of it) and the second div would be 66.6666666%.
Also, in order for your second div to refresh without loading another page, you'll have to use Ajax.
There are css3 columns but they are not supported by IE. What a surprise!
It sounds more like you just need a css layout framework. Search for css frameworks / templates.
I of course recommend simpl.css.
The page is ugly at the moment but will be updated soon.