7 days of unlimited WordPress themes, plugins & graphics - for free!* Unlimited asset downloads! Start 7-Day Free Trial
  1. Web Design
  2. CSS

CSS Charts: How to Create an Organizational Chart

Read Time: 7 mins

In previous tutorials we’ve learned how to create different types of charts including bar charts, thermometer charts, and donut charts. Today we’ll continue this journey by building a CSS-only organizational chart.

Ready to test your CSS skills?

The Organizational Chart We’re Building

Here’s the CSS chart we’ll be creating:

It consists of four levels and describes the hierarchical structure of a company.

What is an Organizational Chart?

To find out what an organizational chart is, let's borrow Wikipedia's definition:

“An organizational chart , also called organigram or organogram, is a diagram that shows the structure of an organization and the relationships and relative ranks of its parts and positions/jobs. The term is also used for similar diagrams, for example ones showing the different elements of a field of knowledge or a group of languages.”

Here’s an example:

By S.s.kulkarni9090 - Own work, CC BY-SA 3.0

This type of chart is commonly used for presenting the relationships between the people or departments of a company. On a corporate website, you will probably find it on the “About Us” or “Company” page.

You’ll also see organizational charts used for family trees (check out the British Royal Family tree and line of succession on the BBC’s website). They’re ideally suited for illustrating hierarchy.

1. Specify the Container

Our chart will live inside a container:

2. Define Some Basic Styles

Before going through its levels, we’ll set up a few reset rules and helper classes:

Notice the rectangle class. We’ll append this to every node/element of our chart.

Note: for simplicity, I haven’t optimized the CSS. This will help you get a better understanding of the styles of each level. 

3. Specify the Levels

At this point, we’re ready to specify the chart levels; as we discussed earlier, here we’ll have four of them:


Each level will represent a role in a company starting from the highest-ranking one.

Level #1

The first level will only include a single node:

Level 1Level 1Level 1


To describe it, we’ll use an h1 tag as it’s the most important part of our chart:


We’ll use its ::before pseudo-element to create a relationship between the first and second levels:

Level #2

The second level will consist of two nodes:

Level 2Level 2Level 2

As we’ll see in a moment, each node will include other child nodes.

These child nodes will represent lower levels of the managerial hierarchy.


To describe it, we’ll use an ordered list with two list items. Each list item will contain an h2 element:


Thanks to CSS Grid, we’ll create the layout for this level.

Next, we’ll use the ::before pseudo-element of specific elements for creating the associations between the nodes of this level and the adjacent levels:

Notice that we also define the ::after pseudo-element of the second-level nodes. This will appear only on small screens.

Level #3

The third level will include four nodes.

We’ll associate the first two nodes with the first node of the second level, while the last two with its second node: 

Level 3Level 3Level 3


Still, inside the initial list where the second level lives, we’ll define two new lists. Each one of them will contain two list items. For each item will specify an h3 element:


Thanks again to CSS Grid, we’ll position the nodes.

In the same way, we’ll set the ::before pseudo-element of specific elements for creating the required connections:

Level #4

We’ll need sixteen nodes for the fourth level. These will equally be distributed into four lists.

Each third-level node will include one list:

Level 4Level 4Level 4


Still, inside the initial list where the second level lives, we’ll define four new lists. Each one of them will contain four list items. For each item will specify an h4 element:


Once more, we’ll set out the ::before pseudo-element of specific elements for associating the fourth-level nodes with their parents:

Organizational Charts and Going Responsive

Making an organizational chart responsive is tricky. I remember myself having to reconstruct the markup one or two times until coming up with this version. So, if you plan to create such a chart, I recommend you follow a mobile-first approach.

With all this in mind, here’s its mobile layout:

Responsive Layout of Organization ChartResponsive Layout of Organization ChartResponsive Layout of Organization Chart

To accomplish this behavior, we have to modify some styles:

We’ve Finished Our CSS Chart!

Congrats, folks! Without writing a single line of JavaScript, we managed to build a fully functional organizational chart.

Let’s remind ourselves of what we built:

Of course, keep in mind that our chart has a specific structure. Depending on your needs, you might want to enrich its content or modify its layout. If you need something more advanced or dynamic, have a look at some JavaScript libraries like Highcharts.js.

Have you ever created a CSS chart? If so, please share your experience with us!

More CSS Charts (Sometimes With JavaScript)

If you still need some inspiration, don’t forget to check at my other charts in the Tuts+ archive or do a quick search on CodePen.

As always, thanks a lot for reading!

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Web Design tutorials. Never miss out on learning about the next big thing.
Scroll to top
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.