Paligo has several admonitions that you can use in your content, including note, warning, danger, important and tip. Each admonition has its own default styling, but you can customize their appearance if needed.
For HTML publications, use CSS to style the admonitions. You add the styling information to a CSS file and then upload that to the HTML layout that you will use for publishing. The following sections explain how to make some of the most common changes.
For PDFs, use the Admonitions settings on the PDF Layout Editor Options.
Tip
To learn about CSS, this CSS Tutorial covers the basics and has links to more resources.
You can use CSS to change the color of the admonitions for HTML outputs. When you add your own CSS, replace the color codes with those for the codes you want to use.
For each admonition, you can change the color of the:
-
Left-margin border
-
Background
-
Symbol
-
Label text
-
Body text
For example, you could change the default green colors and black text of a note to blue with white text.
To change the colors for admonitions:
-
Use a code or text editor to create a CSS file. Give it a suitable name and save it with the
.css
extension. -
To change the color of the various parts of a note:
/* This part changes the color of the left-margin border and the background */ .note { border-left-color:#c5c6c8; background-color:#0540f0; } /* This part changes the color of the symbol */ .note::before { color:#ffffff; } /* This part changes the color of the label */ .note h3 { color:#ffffff; } /* This part changes the color of the body text */ .note > p { color:#ffffff; }
-
To style other admonitions, add extra code and replace
.note
with the name of the admonition (for example.warning
)./* This part changes the color of the left-margin border and the background */ .warning { border-left-color:#c5c6c8; background-color:#0540f0; } /* This part changes the color of the symbol */ .warning::before { color:#ffffff; } /* This part changes the color of the label */ .warning h3 { color:#ffffff; } /* This part changes the color of the body text */ .warning > p { color:#ffffff; }
-
Save your CSS file.
-
When you publish content using the HTML layout, the CSS styles you have added will be included in the published output. Your custom styles take priority over the built in styles.
By default, admonitions have a text label with the admonition type shown before the admonition text. For HTML outputs, you can use CSS to hide the labels if you prefer to use admonitions that only use an icon.
For example, below the warning admonition has a "Warning" label.
To use CSS to hide or show the admonition labels:
-
Use a code or text editor to create a CSS file. Give it a suitable name and save it with the
.css
extension. -
To hide admonition labels, use this CSS code:
.caution h3, .important h3, .note h3, .tip h3, .warning h3{ display: none; }
This sets the labels for all of the admonition types (caution, important, note, tip and warning) to be hidden.
-
Add some extra spacing for the body text of the admonition, to align it with the top of the admonition icon. This gives the text a 10px margin at the top, which is the same amount of spacing that is used for the icon, by default.
To do that, add this code to your CSS:
.warning > p, .note > p, .important > p, .caution > p, .tip > p { margin-top: 10px; }
-
Save your CSS file.
-
When you publish content using the HTML layout, the CSS styles you have added will be included in the published output. Your custom styles take priority over the built in styles.
For HTML outputs, the admonitions use a symbol from FontAwesome 4.6.3 or earlier. This means you can change the symbol with a customized CSS file that references a different symbol.
For PDFs, you can change symbols by uploading your own symbol in the Admonitions settings on the PDF Layout Editor Options.
To use CSS to change the symbol for HTML publications:
-
Refer to FontAwesome 4.6.3 to find the icon you want to use. Make a note of its code.
-
Use a code or text editor to create a CSS file. Give it a suitable name and save it with the
.css
extension. -
To change the symbol for a note, use this CSS code:
.note:before { content: '\f12a'; font-family: FontAwesome; }
In this example, we have used f12a as the example code for a FontAwesome symbol. You will need to replace that with the code for your chosen icon.
-
To adjust the spacing of the icon or its color. You can do that by setting its styles.
.note:before { content: '\f12a'; color: #2ab27b; font-size: 30px; top: 30px; font-family: FontAwesome; }
Here is an example of some styling for a note, where the color is set and the font size and top margin spacing have been increased.
-
To style the other admonition types, add extra code and replace
.note
with the name of the admonition (for example.warning
)..warning:before { content: '\f12a'; color: #2ab27b; font-size: 30px; top: 30px; font-family: FontAwesome; }
-
Save your CSS file.
-
When you publish content using the HTML layout, the CSS styles you have added will be included in the published output. Your custom styles take priority over the built in styles.
Comments
0 comments
Article is closed for comments.