Splunk Search

Right Align Table Cells

srussellnpr
Explorer

When creating a dashboard, I'd like to align the cells with numbers in them to the right (default is left). Any ideas on how to do that?

Thanks, -S.

Tags (1)

lukeh
Contributor

Updated for Splunk 6.x :-

.results-table .wrapped-results th:nth-child(5), .results-table .wrapped-results td:nth-child(5) {
        text-align: right;
}

L.

southeringtonp
Motivator

Normally the answer is CSS. You could do it at the application level, but to avoid bleedover into other places, it's likely better done at the individual view.

To set a per-dashboard stylesheet, edit your <view> tag at the top:

<view stylesheet="mystylesheet.css" template="dashboard.html" ....

and create your CSS file as appserver/static/mystylesheet.css, e.g.:

/* Right-align values in the fifth td tag of the table row */
table.simpleResultsTable tr td:nth-child(5) {
    text-align: right;
}

If the browsers your using don't support nth-child directly, you may be able to find another way to declare the CSS, or maybe you can get around it with jQuery.

Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...