0

I've got I would say rather small problem consider with adding atribute :active to some links on my website. I wrote code where I use jquery tabs where content is loaded via #div tags

For example I click on position "Home" in my menu and its conected to div #home etc I want to make active link bold but when I use

sidemenu li a:active { font-weight:bold; }

bolded text appears only when I hold my left mouse button on it.

Is there any solution to this problem?

3 Answers3

1

Use :visited instead:

.sidemenu li a:visited { font-weight:bold; }

EDIT

To make only the active tab bolded, you will need to use JavaScript. Here is an example:

HTML

<a href="#" class="tab">Tab 1</div>
<a href="#" class="tab">Tab 2</div>
<a href="#" class="tab">Tab 3</div>

JavaScript

$('.tab').click(function(){
    $('.tab').removeClass('active');
    $(this).addClass('active');
});

CSS

.active {
    font-weight: bold;
}

Here is an example.

Yoav Kadosh
  • 4,807
  • 4
  • 39
  • 56
  • I've tried and it doesn't show any effect on my link –  Aug 22 '14 at 00:26
  • 2
    I wonder if `sidemenu` is one of those [new-fangled whizz-bang HTML9 elements](http://html9responsiveboilerstrapjs.com/) I've been hearing about... – Jared Farrish Aug 22 '14 at 00:26
  • @JaredFarrish I think its HTML10 – Oliver Spryn Aug 22 '14 at 00:27
  • @GPJethro Some CSS rules cannot be set for the `:visited` selector. Read: http://stackoverflow.com/a/8331950/1096470 – Yoav Kadosh Aug 22 '14 at 00:29
  • This will make all visited links bold, but the OP wants only the tab being viewed to be bold. – showdev Aug 22 '14 at 00:31
  • I've got something like this in my menu:
  • random name
  • and i connect this element with div #1 in other words, when the div#1 is loaded i want to make link to it in my menu bolded, if some rules cannot be set, are there any other solutions? –  Aug 22 '14 at 00:32