CSS inject

Filters ::: filter_cssinject
Maintained by Manuel Menzinger
This simple filter allows users to add css to their content, without switching to code-view. It also provides pre-made css-classes to visually enhance basic text areas.
Latest release:
42 sites
51 downloads
5 fans
Current versions available: 1

CSS Inject

This simple filter allows users to add css to their content, without switching to code-view. It also provides pre-made css-classes to visually enhance basic text areas.

Usage examples

Use [!box: ... !] to directly apply a bordered css-style around the content. There are several classes that can be used. Classes of a different category can also be combined (e.g.: [!box: info purple!])

To limit the box to just a part of the content, the tags [!box-start: ... !] and [!box-end!] can be used.

[!box: info red!] [!box-start: read!] This is important to read! [!box-end!]

Currently available classes:

// pre-made classes info read warning stop // icons icon_lamp icon_book icon_warning icon_stop // colors gray red green blue yellow orange purple

Advanced usage

Use [!style: ... !] to directly apply css-styles to a new div around the content.

[!style: color:red; font-weight:bold; !]

Use [!class: ... !] to directly apply css-classes to a new div around the content.

[!class: my_awesome_class !]

To limit style and class to a specific part of the content, -start and -end can be used.

[!style-start: color:green;!]...[!style-end!] [!class-start: my_class!]...[!class-end!]

Use [!page: ... !] to directly add pure css to the whole page. It gets injected using a style element.

[!page: * { font-family: "Times New Roman", Times, serif; } !]

Use [!: ... !] and [!!] to directly apply css to a new span around a part of the content.

[!: color:red; font-weight:bold; !] Attention! [!!]

In general, different elements can be nested.

[!box-start: info!] [!style-start: text-decoration: underline; !]...[!style-end!] [!box-end!]

To nest multiple of the same element, a number can be appended to the start and end tags.

[!box-start: info!] [!box-start1: warning!] [!box-start2: stop!]Stop![!box-end2!] [!box-end1!] [!box-end!] [!:color:red!]T[!1:color:green!]es[!1!]t[!!]

For convenience there are some abbreviations for common used css attributes. These are available in style- and inline-elements.

b ... font-weight: bold; i ... font-style: italic; u ... text-decoration: underline; s ... text-decoration: line-through; c:[color] ... color: [color]; bg:[color] ... background-color:[color]; [number][unit] ... font-size: [number][unit];

Example:

[!style-start:c:red;1.5em;u;b;!] Awe[!:bg:#333;c:#fff;i;s;2em;!]so[!!]me [!style-end!]

Screenshots

Screenshot #0

Contributors

Manuel Menzinger (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Plugins bot
    ş, 4 rêb 2025, 9:10 PM
    Approval issue created: CONTRIB-9790
  • Mary Blue
    dş, 19 gul 2025, 7:22 PM
    Dear Manuel, thanks for the nice plugin. I have one question: How do I close [!class: ... !] and [!style: ... !] after the content, so that I can start with new CSS for the following content in the same text area? Best regards
  • Manuel Menzinger
    dş, 19 gul 2025, 7:35 PM
    Dear Mary,
    currently that is not possible, because I chose simplicity (less tags) over complex usecases. You could use [!: display:block; ... !] ... [!!] to achieve basically the same as '[!style: ... !], but limited in scope. For classes you will need to do it the old way by editing the html manually.
    That said, now that I know that there might be a usecase for that, I might find a way to add optional endtags, without adding too much complexity... I will have a look at it during summer, when i have some time.
    Best regards
  • Mary Blue
    dş, 19 gul 2025, 8:01 PM
    Dear Manuel, thanks for the fast response. To have a solution for the classes would be great, as we use the a lot. I first thought [!!] would end them as well. If that would be the endtag for all all the tags, it might still be quite simple. I am looking forward for your next developments.
  • Manuel Menzinger
    în, 23 gul 2025, 7:32 PM
    Dear Mary,
    I had a little time this week and uploaded an update. Now scoping of elements is possible, using start- and end-tags (like [!style-start:...!]...[!style-end!]). Furthermore it is now possible to nest all elements! But when nesting the same type of elementy, they need to be numbered (like [!:c:red!]Helllo [!1:b!]world[!1!][!!] - here you can also see some of the new abbreviations for color and font-weight: bold)
Please login to post comments