1

My father always wanted a website with a seminar chart that consists of circles and lines connecting them as the main navigation to articles on his site. The site will have a header and footer and between, the seminar like chart(kinda like a flow chart but only cirlces). I am not a programmer by would like to do this for my dad. Did some research and found two options. Use images as the circles or use CSS3. Can anyone point me in the right direction. Heres my attempt by hand.

 <!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Circles</title>
    <link rel="stylesheet" href="circle.css">
</head>
<body>
    <div id="wrapper">

        <div id="header"><h1>Header</h1></div>

        <div id="content">

                <div class="c1"><a href="http://www.google.com" class="with-style">Hello</a></div>
                <div class="c1"><a href="http://www.google.com" class="with-style">Hello</a></div>

        </div>

        <div id="footer">My Footer</div>

    </div>  
</body>

My CSS:

 #wrapper {
background-color: black;
position: relative;
width: 600px;
height: 600px;
margin: 0 auto;
}
#header {
height: 8.3%;
width: 100%;
background-color: gray;
text-align: center;
}
#content {
color: green;
}

a.with-style {
display: block;
width:100px;
height:100px;
border-radius:50px;
font-size:20px;
line-height:100px;
text-align:center;
text-decoration: none;
text-shadow: 0 1px 0 #f15;
color: white;
background: blue;
}

a.with-style:hover {
border: 4px double #bbb;
color: #aaa;
text-decoration: none;
background: #e6e6e6;
}

div.c1 { display: inline; }

#footer {
background-color: grey;
text-align: center;
position: absolute;
bottom: 0px;    
height: 8.3%;
width: 100%;
 }
1
  • 1
    can you make an illustration for this so we can better help Commented Mar 5, 2013 at 5:16

4 Answers 4

1

You could use CSS3 rounded corners as in this article. It's straight forward and is widely supported.

Another option would be to use JQuery and its extension, JQuery UI which achieves the same result but increases the compatibility with older browsers. Unfortunately it would slightly increase load times, and makes things a bit more complicated. Saying that, it's simpler than implementing your own concoction of CSS3 and images as fall-back.

2
  • what about lines and connecting them. I should look like a chart? Commented Mar 5, 2013 at 4:57
  • 1
    good point. I would use Karma's suggestion, RaphaelJS. It's easy to learn, quick to write, and is compatible with a large proportion of browsers. It's also very powerful as you can see from his example.
    – Jodes
    Commented Mar 5, 2013 at 7:40
1

Have you checked Raphael.js? Looks good to me. Also you will get curve lines and much more flexible options.
Circle using Raphael.js http://raphaeljs.com/reference.html#Paper.circle

Here is something I have created using Raphael, not a chart but will give a idea about what you can do.

http://jsfiddle.net/Ajinkya_Parakh/J3zJF/embedded/result/

0

mostly using

    border-radius:50%

always makes the div a circle, however It's not compatible with IE 8 and below. So if your not aiming at those browsers, this method should help, else use images.

0

The option you take depends on what browser support you want to achieve.

OPTION 1 - with CSS This option only works in modern browsers: http://caniuse.com/border-radius But if you are not concerned about this, I would go with this option.

OPTION 2 - images With this option you want to create a large circle graphics in a graphics program like photoshop, fireworks, etc. And then scale down that graphic to the sizes that you want. This option is harder and requires more effort.

For circles in CSS, use "border-radius: 50%;". The 50% ensures that no matter what size the div element is, it will always be a circle(or an oval if the height and width are different).

However if you are trying to create a graph of some sought, there are some libraries/plugins that you can utilize. My favorite is: http://www.highcharts.com/demo/ This is a really extensive library of charts, which are free for non-commercial sites.

Not the answer you're looking for? Browse other questions tagged or ask your own question.