Change the style of tab markers: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
m (added link to editing config files)
(Simplified CSS and linked to new Unread Tabs extension)
Line 4: Line 4:


  /* Italicize the title of unread tabs */
  /* Italicize the title of unread tabs */
  #content tab {
  #content tab:not([selected]) {
   font-style: italic !important;
   font-style: italic !important;
  }
  }
 
/* Normalize the title of selected tab */
'''How it works:''' The CSS selector causes the style rule to be applied to all tab elements without a '''selected''' attribute - which is only the case for a new, unread tab. When the user switches to that tab, it gains '''selected'''='''true'''. When another tab is selected, the previous tab's '''selected''' attribute is not removed, but changed to '''false'''.
#content tab[selected="true"] {
 
  font-style: normal !important;
You can also apply this modification by installing the [[http://blog.codefront.net/mozilla/unreadtabs/|Unread Tabs]] extension, which is based on the code above. However, it won't allow you to define another style for unread tabs, though.
}
/* Normalize the title of read unselected tabs */
#content tab[selected="false"] {
  font-style: normal !important;
}

Revision as of 09:19, 21 December 2004

Some themes change the style of tab markers on the tab bar. They usually use CSS to do it, and you can add the same CSS to your user configuration files to achieve the same effect ‘permanently’, that is, irrespective of (and overriding) your chosen theme.

For example, adding the following code to userChrome.css will cause the title text of unread tabs opened in the background to appear in italics until that tab is read for the first time.

/* Italicize the title of unread tabs */
#content tab:not([selected]) {
  font-style: italic !important;
}

How it works: The CSS selector causes the style rule to be applied to all tab elements without a selected attribute - which is only the case for a new, unread tab. When the user switches to that tab, it gains selected=true. When another tab is selected, the previous tab's selected attribute is not removed, but changed to false.

You can also apply this modification by installing the [Tabs] extension, which is based on the code above. However, it won't allow you to define another style for unread tabs, though.