Creating Components with HTML and CSS
Last updated
Was this helpful?
Last updated
Was this helpful?
Components for Setka Editor are made two ways:
In the Editor itself. To do this, build up the element and save it using the Component button in the right-hand panel. More on it in .
In the CDSM. It can be used to turn any HTML code into a component. This is useful if the standard features of the Editor are not enough. E.g. additional decoration or some specific structure is needed.
Any valid HTML code can be used as a component. The code also utilizes the standard Setka Editor elements: grids, columns, paragraphs, galleries, and images. They must contain the appropriate CSS classes. You can use your own classes in addition to the standard ones.
Follow the guidelines below to create valid components that will be accepted by the Editor.
A component can consist of the following elements:
The main container of any Setka Editor publication.
Post can contain
Post cannot contain
Paragraphs and headers
Decoration tags: <strong>
, <i>
, <em>
, <a>
, <u>
, <del>
, <sup>
/<sub>
, <span>
, <br>
Images, <img>
tag
Galleries
Dividers
Grids
Containers
Columns
The post cannot contain pure columns. Each column must be wrapped in a grid.
A paragraph is a basic content unit in Setka Editor. Any text should be placed inside a paragraph. Along with the paragraphs, there are also headings. Heading tags are: <h1>
– <h6>
.
A paragraph can be inside
A paragraph can contain
Post
Column
Container
Text
Decoration tags: <strong>
, <i>
, <em>
, <a>
, <u>
, <del>
, <sup>
/<sub>
, <span>
, <br>
Images, <img>
tag
A paragraph cannot be placed inside
A paragraph cannot contain
Grid
Anything besides text, decoration, and images.
A paragraph cannot be placed inside a grid. Before placing a paragraph into a grid, you need to divide this grid into columns or create one column for the entire width of this grid.
Layout Grid is used as a framework for a multi-column layout. Each grid consists of a container (stk-grid
) and column (stk-grid-col
). Images, paragraphs, and all other content types are placed within the columns.
A grid can be placed inside
A grid can contain
Post
Column
Container
Column
A grid cannot be placed inside
A grid cannot contain
Paragraph
Nothing but columns. All grid content must be arranged in columns.
You need to set the data-col-width
attribute for a column that determines its width. This attribute can be an integer from 1 to the maximum number of columns in a given grid. For example, in a 6-column grid, the data-col-width
attribute can take values from 1 to 6.
A column can be placed inside
A column can contain
Grid
Paragraph
Grid
Image
Embed
Divider
Gallery
Container
An image consists of:
An image container —image-figure
.
A mask — mask
.
The image itself — <img>
.
An image caption — <figcaption>
.
All these elements are mandatory except for the caption.
An image placeholder can also contain a link:
An image can be placed inside
An image can contain
Post
Column
Gallery
Container
The image cannot contain any additional elements.
Image placeholder — a place to insert an image into a post. When clicked, it opens the image selection menu on the right toolbar.
An image placeholder consists of:
An image container —image-figure
.
A mask — mask
.
An image caption — <figcaption>
.
All these elements are mandatory except for the caption. The placeholder should not contain the image itself (the <img>
tag).
An image placeholder can be placed inside
An image placeholder can contain
Post
Column
Gallery
Container
The placeholder cannot contain any additional elements.
An embed code structure is similar to an image and can contain any HTML code inside the <code>
element, including <style>
or <script>
.
An embed can be placed inside
An embed can contain
Post
Column
Container
Some HTML code.
A divider can be placed inside
A divider can contain
Post
Column
Container
The divider is an independent element. It cannot contain other elements within itself.
A gallery can be placed inside
A gallery can contain
Post
Column
Container
Images
A container is a universal entity for any block type that can not be formed through the standard Setka Editor elements. Any class or attribute can be assigned for a container, ad for any other elements.
Containers can also be used to form block links:
A container can be placed inside
A container can contain
Post
Column
Container
Paragraph
Grid
Image
Embed
Divider
Gallery
Container
The component in an article is presented as static HTML code. In most cases, deleting a component from the style wouldn't affect the pages it was used on.
Replace stk-theme_XXXX__style_large_header
and stk-theme_XXXX__style_small_header
with .
Replace stk-theme_XXXX__style_large_header
with the .
Replace tk-theme_XXXX__separator_basic_divider
with the .
A gallery is a container for images. Gallery's JavaScript makes an animated slideshow in the preview mode and on the page where a post is published. The are placed inside the gallery.
Delete components with carefully. Make sure other components and style elements do not rely on this component's CSS rules defined in the Custom CSS for component field.
If you need to delete the component that contains custom CSS, copy the content of the Custom CSS for component field and .