I’m not an expert in CSS. Could someone please help whether it’s possible to create a columns like below using pure CSS?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When the descriptions are considered, this becomes a much harder problem. The bars are relatively easy, and can be built with somewhat semantic markup (although this could probably be improved):
And the styles,
Here’s a working demo: http://jsbin.com/obexew
I added a couple sample classes that assume a scale from 1 to 10, although it may be more practical to manually set the height as an inline style, or set it as a data attribute and update the height with JavaScript. I’ll leave that up to you to figure out and decide.
Keeping the description in the same element as the bar can be tricky, since it creates a situation where the columns are being aligned to an arbitrary point in each column. Without playing with it more, I would create a separate list for descriptions, and style it so it gets placed below the graph, like so:
And then modify the styles so that the coloring and position is applied within
.bars, but also apply a fixed with to.graph lito align the bars and descriptions.The complexity is completely dependent on how flexible you want your layout to be. I would recommend just diving in and seeing what you can achieve, and play with selectors and rules until you get the effect you need. I’ve been intentionally vague on some of these points so you get a chance to learn what works and what doesn’t.