|
1
|
# Fossil CSS Tips and Tricks |
|
2
|
|
|
3
|
Many aspects of Fossil's appearance can be customized by |
|
4
|
[customizing the site skin](customskin.md). This document |
|
5
|
details certain specific CSS tweaks which users have asked |
|
6
|
about via the forums. |
|
7
|
|
|
8
|
This is a "living document" - please feel free to suggest |
|
9
|
additions via [the Fossil forum](https://fossil-scm.org/forum/). |
|
10
|
|
|
11
|
This document is *not* an introduction to CSS - the web is |
|
12
|
full of tutorials on that topic. It covers only the specifics |
|
13
|
of customizing certain CSS-based behaviors in a Fossil UI. That said... |
|
14
|
|
|
15
|
## Is it Really `!important`? |
|
16
|
|
|
17
|
By and large, CSS's `!important` qualifier is not needed when |
|
18
|
customizing Fossil's CSS. On occasion, however, particular styles may |
|
19
|
be set directly on DOM elements when Fossil generates its HTML, and |
|
20
|
such cases require the use of `!important` to override them. |
|
21
|
|
|
22
|
|
|
23
|
<!-- ============================================================ --> |
|
24
|
# Main UI CSS |
|
25
|
|
|
26
|
## Number of Columns in `/dir` View |
|
27
|
|
|
28
|
The width of columns on the [`/dir` page](/dir) is calculated |
|
29
|
dynamically as the page is generated, to attempt to fit the widest |
|
30
|
name in a given directory. The number of columns is determined |
|
31
|
automatically by CSS. To modify the number of columns and/or the entry width: |
|
32
|
|
|
33
|
```css |
|
34
|
div.columns { |
|
35
|
columns: WIDTH COLUMN_COUNT !important; |
|
36
|
/* Examples: |
|
37
|
columns: 20ex 3 !important |
|
38
|
columns: auto auto !important |
|
39
|
*/ |
|
40
|
} |
|
41
|
/* The default rule uses div.columns, but it can also be selected using: */ |
|
42
|
div.columns.files { ... } |
|
43
|
``` |
|
44
|
|
|
45
|
The `!important` qualifier is required here because the style values are dynamically |
|
46
|
calculated and applied when the HTML is emitted. |
|
47
|
|
|
48
|
The file list itself can be further customized via: |
|
49
|
|
|
50
|
```css |
|
51
|
div.columns > ul { |
|
52
|
... |
|
53
|
} |
|
54
|
ul.browser { |
|
55
|
... |
|
56
|
} |
|
57
|
``` |
|
58
|
|
|
59
|
|
|
60
|
<!-- ============================================================ --> |
|
61
|
# Forum-specific CSS |
|
62
|
|
|
63
|
## Limiting Display Length of Long Posts |
|
64
|
|
|
65
|
Excessively long posts can make scrolling through threads problematic, |
|
66
|
especially on mobile devices. The amount of a post which is visible can |
|
67
|
be configured using: |
|
68
|
|
|
69
|
```css |
|
70
|
div.forumPostBody { |
|
71
|
max-height: 25em; /* change to the preferred maximum effective height */ |
|
72
|
overflow: auto; /* tells the browser to add scrollbars as needed */ |
|
73
|
} |
|
74
|
``` |
|
75
|
|