Using the TimelineJS CSS selectors

If you want to change the way TimelineJS looks, first check out our style and presentation frequently asked questions. In particular, note that there is no way to override the CSS using the iframe embed. You will need to be able to instantiate the Timeline in javascript on your own page. Then, either in style tags in that page, or in an external stylesheet, you can specify CSS rules changing some or all of TimelineJS's default presentation.

Timeline CSS classes

This table lists the major CSS classes which TimelineJS uses. You may just be able to tweak some of these. However, TimelineJS uses Less for CSS preprocessing, which means that some of the CSS rules are very specific. If just overriding a class doesn't seem to work, read more about Timeline and Less below.

Slide options affect the media and text areas of slides.

Class Name
Element Type?
Notes
tl-timeline
div
Added to the initial div containing the timeline. Contains entire element.
tl-slider-container-mask
div
A wrapper around the slides. Background colors or images can be set here.
tl-slide
div
Each complete set of slide items. May appear in conjunction with .tl-slide-titleslide (for title slides) or .tl-slide-media-only (slides without text).
tl-media-content-container
div
Contains the media, its credit, and its caption.
tl-media-content
div
Contains the media item. Use this to add borders, padding and more.
tl-credit
div
The media item's credit.
tl-caption
div
The media item's caption.
tl-text
div
The slide's text plus padding. Add background color to the text portion of the slide here.
tl-text-content-container
div
The slide's text minus padding.
tl-headline-date
h3
The date that appears over the slide's headline.
tl-headline
h2
The slide's headline. Title slides have the additional class .tl-headline-title. Note that you will probably need to use the selector h2.tl-headline to change the appearance of the slide titles.
tl-text-content
div
The text of the slide, in p tags.
tl-slidenav-next
or
tl-slidenav-previous
div
The navigation and text for moving forward and back. Use in conjunction with the following selectors to render the navigation arrows and text.
tl-slidenav-icon::before
div
Inserts the navigation arrow. Preface with .tl-slidenav-next or .tl-slidenav-previous to specify which arrow to render.
tl-slidenav-title
div
The title of the next/previous slide. Preface with .tl-slidenav-next or .tl-slidenav-previous to specify which title to render.
tl-slidenav-description
div
The description of the next/previous slide. Appears on hover. Preface with .tl-slidenav-next or .tl-slidenav-previous to specify which description to render.

Timenav options affect the portion of the timeline that renders the time series.

Class Name
Element Type?
Notes
tl-timenav
div
The timeline element. Change the background color here.
tl-menubar
div
The zoom icons.
tl-timemarker
div
All of the elements that make up the markers (flags and lines) on the timenav. The marker of the current slide also has the class .tl-timemarker-active.
tl-timemarker-content-container
div
The flag of the marker. You can set the flag's background color and text color here. When writing styles for this selector, preface this selector with .tl-timemarker (for slides other than the current slide) or .tl-timemarker.tl-timemarker-active (for the current slide).
tl-timemarker-timespan
div
The width of the marker. This draws the translucent background behind markers if your event has a start and end date. When writing styles for this selector, preface this selector with .tl-timemarker (for slides other than the current slide) or .tl-timemarker.tl-timemarker-active (for the current slide).
tl-timemarker-media-container
div
The icon or thumbnail representing the media in the timeline flag.
tl-headline
h2
The text of the flag. Set color and font family here. Note that this is the same class used for the headline in the main slide body. If you want to change only the headline in the navigation, use .tl-timemarker .tl-timemarker-content-container .tl-timemarker-content .tl-timemarker-text h2.tl-headline. (Yes, ideally it wouldn't need to be so specific, but for now, it does.)
tl-timeaxis
div
The ticks representing the timescale.
tl-timeaxis-background
div
The appearance of the background for the tick marks.
tl-timeaxis-tick:before
div
The line drawing the tick. Set the background color to change the color of the line. Preface with .tl-timeaxis-major to target major ticks or .tl-timeaxis-minor to target minor ticks.

TimelineJS and Less

TimelineJS uses the Less CSS pre-processor to manage the complex number of elements, variables, and conditions needed to make everything look great. One side effect of how we use Less is that various style rules for TimelineJS are often very specific. Since, in CSS, more specific rules take precedence over less specific ones, you may find it easier to edit Timeline's Less files and compile your own stylesheet than to work out the exact selector which controls style rules.

A full Less tutorial is outside the scope of this documentation. In the future, we may be able to provide a few more tips about how our Less files are organized, but the main thing you need to know is this: even though there are many Less files in our Github repository, you only need to compile TL.Timeline.less, which links to all of the others. And you don't need to set up our full-fledged development environment to compile Less. See the Using Less documentation for more information.