In previous recipes, we have seen how to control the look and feel of JavaFX graphical nodes programmatically by setting property values on the node directly. Programmatic style manipulation works just fine, but is hard to externalize. If you want to update the look of your application, you must recompile. However, JavaFX also offers a way to declare styles using Cascading Style Sheets (CSS). This recipe shows you how to apply styles declaratively to JavaFX graphical nodes using CSS.
Before going through this recipe, you should have an idea of what CSS is and how it is used for designing HTML web pages. Similar concepts are discussed here and other CSS-related recipes in this chapter. CSS was created by the web governing body W3C and is traditionally used for markup development languages such as HTML and other XML-derivatives (XUL, SVG, and so on). For information about CSS, visit http://en.wikipedia.org/wiki/Cascading_Style_Sheets.
To illustrate...