0

I have a graph details, but i would like to show using css shapes. for that i am trying to create a css3 shapes to match my graphics ( see attached ) but i am not able to get the result.

How to reproduce this graphics?

Here is the image

my try: this is very bad:

<div class="container">
    <div id="triangle-red"></div>
    <div id="triangle-blue"></div>
    <div id="triangle-yellow"></div>
</div>

#triangle-red {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid red;
}

#triangle-blue {
    height: 0;
    width: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-top: 100px solid blue;
}
#triangle-yellow 
{
    width: 0;
    height: 0;
    border-top: 50px solid transparent;
    border-right: 100px solid yellow;
    border-bottom: 50px solid transparent;
}

demo online

Note: according to the values of each comb, i would like the calculate the height and width, by the data what i am getting. (it's like graph)

3
  • I'm not sure those shapes can be created using "css shapes" (looks like you're using borders), not without some sort of CSS transforms anyway. Commented Jul 30, 2015 at 7:11
  • Can you post your ideas please? Commented Jul 30, 2015 at 7:20
  • A <canvas> may be a better approach. Two libraries I would recommend is D3 and Flot Commented Jul 30, 2015 at 7:31

1 Answer 1

1

First of all you will need 6 divs.

every div is triangle : to make one with css check this

use transform:rotate(xdeg)

for the shadows just change the color.

also use z-index to make the red divs above the blues

Sign up to request clarification or add additional context in comments.

1 Comment

As like your Idea, I tried here. still can you help me to fine tune or show me even good approach. jsfiddle.net/u78bQ/441

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.