Using CSS in GeoServer
We have seen that SLD has very powerful styling capabilities, although due to XML's verbose nature, SLD documents can easily become unmanageable with the style's complexity. XML is great for computers; they can easily parse and serialize documents in this format. However, they are inconvenient for humans. There is another styling language created for defining styles in a more concise manner--CSS (Cascading Style Sheet). CSS fits human logic better; we just need to understand its cascading behavior. Cascading, in this sense, can be understood with this rule--every matching definition gets applied, but on collision, the most specific definition wins. Let's look at an example. With the following snippet, we can style our GeoNames layer:
* { mark-size: 6; } [featurecode LIKE 'PPLA%'] { mark: symbol('circle'); } [featurecode LIKE 'PPLA%'] [population > 100000] { mark-size: 8; }
The least specific rule is the *
wildcard, which selects...