How to create dynamic responsive four columns with border style?
Tags: javascript,jquery,css
Problem :
I'm working on a responsive four columns and I want to make it dynamic since i'll be creating this one for custom_post
in wordpress. Here is my problem.
Since it's dynamic then the maximum column is 4 so I have this list of items I want to remove the border-style
of the last element so I can make it using :last-child
but my problem is that if the page is being resized then the columns will split into 3 , 2 , 1 and so on and also if I have just 1 or 2 or 3 items how can I target that items and have those borders in the middle and make it horizontally center. Do I need to do this with jquery or I can make it with pure CSS?
Check my fiddle
Note: I can have as many item as possible.
Solution :
You will certainly need @media queries for the borders.
To center the items you could use
#spring-vet-inner {
text-align: center;
}
#spring-vet-inner .sv-list {
display: inline-block;
width:50%;
text-align:center;
margin-top:40px;
box-sizing:border-box;
}
https://jsfiddle.net/stby04/m1x78tL2/