With GoLand, you can use most common Style selectors: universal selector
*, type selectors
.a, descendant selectors
.a.b, child selectors
.a .b, ID selectors
#b, pseudo-classes and class selectors
Working with style declarations
GoLand lets you create new rulesets from existing declarations and even move entire rulsets other files using CSS-aware intention actions and refactoring.
To extract a ruleset
Select the declarations to extract. If you need only one declaration, just place the cursor inside it.
Press Alt+Enter and select Extract ruleset from the list.
GoLand creates a new ruleset with the same selector and moves the selected declarations to it. If the selection contains comments, nested selectors, etc. they are also moved to the new ruleset.
To move a ruleset to another file
Place the cursor anywhere in the ruleset and press F6.
In the dialog that opens, specify the file to move the ruleset to. If the specified file does not exist, GoLand will suggest creating it.
By default, GoLand automatically opens the file where the ruleset is moved. To change this behavior, clear the Open in editor checkbox.
Completing CSS classes
GoLand first suggests classes and ids from the style tag and linked files. But if no matching results are found, GoLand also suggests symbols defined in all stylesheet files in the project. To see all classes and ids defined in the project straight away, before you start typing, press Ctrl+Space twice.
Changing Color Values in Style Sheets
With GoLand, you can easily change color values in Style Sheets without typing hexadecimal codes codes.
To choose a color
Open the desired Style Sheet for editing.
color:, and then press Ctrl+Space.
Select the desired color value from the suggestion list or choose color... to pick a custom one:
To change a color
Open the desired Style Sheet for editing, and locate the color property that you want to change.
Click the color icon in the gutter.
Alternatively, if the icons are not shown, press Alt+Enter and select Change color from the list.
In the Choose color dialog that opens, pick the desired new color and click Choose.
To preview the code of a color
GoLand marks each
colorproperty with a gutter icon of the corresponding color. When you hover over a color icon, GoLand displays a popup that shows the color preview and its hexadecimal code.
To show color icons in the gutter
By default, GoLand displays color icons in the gutter. If they are for some reason hidden, you can return them at any time.
In the Settings/Preferences dialog (Ctrl+Alt+S), go to . The Gutter Icons page opens.
In the Common area, select the Color preview checkbox.
Viewing the Styles Applied to a Tag
For HTML, XHTML files, GoLand suggests a way to explore all styles applied to an arbitrary tag.
The results for each tag are displayed in the dedicated tabs of the CSS Styles tool window. Using this tool window, you can view the list of styles applied to a tag, and the definition of these styles. Besides that, you can navigate from style to the corresponding tag in the source code.
Open the desired file in the editor, and right-click the tag you want to explore for applied styles.
From the context menu, choose.
View results in a dedicated tab in the CSS Styles tool window: