Apr 3, 2012


TABS, a famous word in website development. Every coder has used it in websites but only using JQuery. Today I ll share a small trick to use tabs without using any JQueries but only using CSS3.


Like previous tutorial on CSS3 toggle, in this also we will use pseudo element :target

The logic is really simple, we will form an unordered list, and inside li there will be a div with unique ID, when this unique ID will be called through some href link then the respective div will appear.

So here is the basic HTML Code:

<div id="container">
<p style="text-align:center;">CSS3 TABS. <b><i>NO JAVASCRIPT&nbsp;</i></b></p>
<div id="tabs">
<li id="One"><a href="#One" id="first">One</a>
<p>In today’s tutorial I am going to share a simple way to make News Ticker and Notification Bar using CSS3, NO JAVASCRIPT. Previously it was very difficult to code it in javascript and make it work with other plugins, but today I decided to make it possible in CSS3 and voila, I succeeded So lets</p>
<li id="Two"><a href="#Two" id="sec">Two</a>
<p>While reading more about HTML5 & CSS3 I just found an amazing css3 button styling. This time I wanted to do something which I was doing from past 2 years using JQuery. In this tutorial I am going to teach you how to make a toggle slideDown and slideUp function using CSS3 and HTML5. To</p>
<li id="Three"><a href="#Three" id="third">Three</a>
<p>Lets start learning CSS3 before its too late, I just saw a website which amazed me with its animation effects. First I thought that the site is using some JQuery libraries but when I actually went into the code, I found it is CSS3. So I started learning it, and today I made my first Read more...</p>

We will be using transition to show the fade in fade out effect using opacity. On click of href the transition will be triggered and the opacity of the div changes.


li div {
-moz-transition: all 0.5s ease 0s;
-webkit-transition: all 0.5s ease 0s;
border: 1px solid #888888;
float: left;
opacity: 0;
padding: 0 15px;
position: absolute;
visibility: hidden;
width: 250px;
background: -moz-linear-gradient(center top , #E3E3E3, #FFFFFF 85px) repeat scroll 0 0 transparent;

#tabs li a{
background: -moz-linear-gradient(center top , #E3E3E3, #FFFFFF 18px) repeat scroll 0 0 transparent;
border: 1px solid #888888;
margin: 0 3px 0 0;
padding: 5px 25px;
position: relative;
font-size: 14px;
border-radius:10px 10px 0 0;

#One:target div, #Two:target div, #Three:target div{

You can download and check the demo, share it if you like it and suggestions are always welcome.


  1. it does not display the tab content in ie 8

  2. IE8 does not supports CSS3, in IE9 it will work

  3. Nice tutorial, but it's possible to make this CSS3 Tabs compatible with IE6-IE8? and how to do it?

  4. You cant do that cause IE6 - 8 css3 is not compatible.

  5. with any trick? how about that famous "Minimizr"?

  6. You can do that by using some js, but if you really want to use that then I would prefer Jquery tabs

  7. Actually I use jQuery Tab Slider but I would like a lot to change this for CSS 3 Tab Slider, but I still receiving 25% from IE 6-8 :( there's a way to make compatible via JS but only for IE6-8?

  8. I have never used it, but heard a lot about it


    It makes CSS3 compatible in IE6-8

  9. I've got an idea, drop all support for IE issues concerning such bleeding edge tech.

  10. Nice CSS only difficulty I'm having is when I've got the tabs in a page (half way down) and each tab has loads of content in it causes an overflow issue. I suspect it's to do with position: absolute any clues/work rounds anyone might have it would save me going prematurely bald?
    one other thing who to display tab #one on page open?

  11. great css, only one issue hopefully someone can help with, I've got the tabs at the bottom of my page, if I put too much in each content it causes overflow issues,
    also other than setting the link to #One is there any way to open the page with the first tab open?
    Cheers JT

  12. Wish it worked on Android ICS.

  13. How can i get visible block "one" by default?

  14. Just install Chrome.

  15. yosmomas Bli19/11/13 12:55 AM

    awesome. this is perfect for what i'm doing. Jquery or javascript was not doing it. As soon as I clicked on a different tab all live actions on the selected tab stopped. THIS WORKS GREAT. I can see this as a library.