Responsive Tabs / Posts /

different background colours matching tabs

19
Hi is it possible to have say for example 3 or 4 tabs each a different colour, and when the tab is clicked it displays the same background colour in the area below as the tab that was clicked? Please could we have an example code for that?
Joe  10 years ago   viewed: 9657    

1 Answer

-2
Assume you want the second tab to have a different background, you can try adding the following lines to the mctabs.css file:
ul.mctabs li:nth-child(2) a {background:black;} ul.mctabs li:nth-child(2).selected a {background:green;}

You also need to check other li a selectors such as ul.mctabs li a:hover and insert nth-child(2) into it.

Above is not supported by IE 8 and earlier.

I've only tested them in Chrome. It seems

ul.mctabs li:nth-child(2).selected a {background:green;}
can also be written as:
ul.mctabs li.selected:nth-child(2) a {background:green;}
But I haven't tested it in other browsers.
Milo   10 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: