The Span macro wraps content in a span tag with optional class and styles. The span tag is a non-visual (by default) element that can be used to apply additional properties to content contained within it. Unlike the div tag, a span does not stretch to fill the available width of its containing element, making it ideal for use with inline content such as a portion of text in a paragraph or a cell within a table. This macro is primarily designed for use with the CSS Stylesheet macro to make it easier to apply custom styles to content. Alternatively, specify styles for each use of the macro.
Navigate to the page you want to edit.
- Click the location on the page where you want to add the macro. You can reposition the macro placeholder later if necessary.
Click Insert More Content > Other Macros.
Select the Span macro from the Macro Browser.
Customize the macro using the following parameters:
Option to specify a unique ID for this element. If using this parameter to apply styling to the element, do not include the
Option to apply a custom CSS class to the element. Enter the CSS class name(s) to apply to the macro (case sensitive); multiple classes can be separated by a space or comma. Do not include the
.selector in the class name. Classes must be part of your Global Confluence CSS or defined in a CSS Stylesheet macro that you have added to your page.
Option to apply an inline style to an individual span tag body content; useful for adding borders or padding, e.g.
border: 3px solid-red. This style does not need to be defined in a CSS Stylesheet macro.
Enter the text to display in a tooltip
Set the text direction.
Enter a language code if you want to specify that the element content language is different from the default language of your page, e.g.
defor German. Browsers will identify that the content is written in German.
Specifies that the macro will be displayed inline with the surrounding content
Click Insert. The macro placeholder displays.
- Enter the body content as required then save the page to render the macro on the page.
Define a span
By default, a span does not affect the way things look on screen:
This will add the following HTML to your page:
<p>This is <span>a span</span> example
This is a span example. The macro only becomes useful when its parameters are used as shown in the following examples.
To define a custom class, enter the class name in the Class parameter. The class will be applied only to the content contained within the Span macro.
If you are using borders, images, or icons, inline styles can be used to add padding between the Span macro content and other content.
Hints and tips
Frequently Asked Questions
Q: Where can I learn more about CSS and Span tags?
A: Try http://www.w3schools.com, as they have full tutorials on CSS and HTML.