Syntax Highlighter Element

Last Update: March 12, 2024

The Syntax Highlighter Element is our solution to allow you to provide code snippets in a variety of different languages in a copyable, embeddable format directly on your website. Aside from the 4 pre-set style options, it comes with several customization options to control all colours, borders, text, line wrapping, code copying and more.. Read below for an overview of the specific features of the Element.

For privacy reasons YouTube needs your permission to be loaded.

How To Use The Syntax Highlighter Element

To start, add the element into your desired column.

To view the possibilities of this element, make sure you visit the Element Demo page. The element has two tabs; General and Design. On the General tab, the first thing to do is to insert the code you wish to highlight. Directly below that, you can choose from any of the 4 preset style options for the snippet. Then select the coding language that the snippet is in (this assists with correct styling). There are also a number of options to show or hide line numbers and to add the ability for the user to copy the code to the clipboard. The Design tab offers a number of styling options to further customize the element.

Element Options

Note: The Default setting will use the global settings assigned for this element in your Options > Avada Builder Elements > Syntax Highlighter Element section.

General

HeadingDescription
Code to HighlightEnter some code to be displayed with highlighted syntax.
Highlighter ThemeSelect which theme you want to use for code highlighting.
Code LanguageSelect the language the code is in.
Line NumbersChoose if you want to display or hide line numbers.
Line WrappingControls whether the long line should break or add horizontal scroll.
Copy to ClipboardChoose if you want to allow your visitors to easily copy your code with a click of the button.
Copy to Clipboard TextEnter text to be displayed for user to click to copy.
Element VisibilityChoose to show or hide the element on small, medium or large screens. You can choose more than one at a time.
CSS ClassAdd a class to the wrapping HTML element.
CSS IDAdd an ID to the wrapping HTML element.

Design

HeadingDescription
Font SizeControls the font size of the syntax highlight code. In pixels.
Border SizeControls the border size of the syntax highlighter. In pixels.
Border ColorControls the border color.
Border StyleControls the border style.
Background ColorControls the background color for code highlight area.
Line Number Background ColorControls the line number background color for code highlight area.
Line Number Text ColorControls the line number text color for code highlight area.
MarginControl spacing around the syntax highlighter. In px, em or %, e.g. 10px.