Template:Eventmath tab/doc

From Wikiversity
Jump to navigation Jump to search

Description[edit source]

This template is adapted from {{Tab}}. That template supports changing the background color of tabs but not the label color. There are three differences in this adaptation.

  1. It supports new parameters: on label color and off label color. These make it possible to customize the label color of selected and unselected tabs in the same way that the background color can be customized.
  2. It makes all labels bold by default (instead of only the selected label being bold). This ensures all labels are easy to read.
  3. It introduces the HTML class attributes on-tab-label and off-tab-label to allow custom styling of tab labels via the TemplateStyles extension. For example, this can be used to remove text decoration such as underlines that appear when a user hovers over a link. An advantage over inline styling is that this makes it possible to target CSS pseudo-classes like :hover, if desired.

This template was created for the Eventmath learning project, but it may be generally useful. It was created separately to avoid accidentally breaking pages that use the original Tab template, but it's possible that the features in this template will be added to the original Tab template in the future.

Note: Since this template is designed for Eventmath, the stylesheet with Eventmath's custom styles is loaded directly into the template, which makes it possible to change the style of all Eventmath tabs without adding a <templatestyles src="[my style sheet]" /> type of tag to each of the main project pages. A more general version of this template could support custom styling for other projects by excluding this tag from the template itself, so that each project could load its own styles directly from their project pages.