Data privacy notice

 

When this content is loaded, usage information is transmitted to Vimeo and may be processed there.

 

             

Examples of Customization for Appearance / CSS

Modified on Wed, 31 Jul at 10:06 AM

This page shows various examples of how to customize the appearance of forms. 

Contents


Inserting a graphic into form header

Three different ways of inserting graphics in the visible header area on all form pages are described below


The examples shown here must be inserted into the CSS area of the designer, within a design template, or in a .css file in the form or client (Files & templates > Files). 


Using an externally hosted image

to position an externally hosted (small) Logo in the center right of the header, the following code can be used as a basic:

.XHeader {
   /* selects the image via URL */
   /*the positioning of the image: */
   background-image: url('https://example.de/path/to/image/logo.png'); 
   /*determines the image to 25 pixel of height and the width according to the 
      aspect ratio of the image*/
   background-size: auto 25px; 
   height: 60px; /*determins the height of the header to 60 pixel */
   background-repeat: no-repeat; /*displays the image only once */
   /*positions the image 30 pixel from the right edge*/
   background-position-x: calc(100% - 30px); 
   /*positions the image 20 pixel from the upper edge*/
   background-position-y: 20px; 
}


Using a client or form resource

Note: 
Please note the URL sepcification on the right side under properties. For that URL specification, it is identifiable that the pid parameter is used under Files in the designer.
This is the so-called Project ID. Under Files & Templates > Files, however, the mid parameter is used, which passes the Client ID. Since the files are in different contexts, it is necessary to pass the parameter according to the storage location. However, the name parameter is always present, as it passes the name of the file to be retrieved.



The code below can be used to display an image file labeled as header.pngthat is uploaded as a client resource (Files & Templates > Files). This code positions the image over the entire header size of a form with the client  id 1234:

.XHeader {
   /*selects the image relative to URL of the client resource */
   background-image: url('../includes/ressource?mid=1234&name=headerbild.png'); 
   /*the positioning of the image: */
   /*displays the image over the entire size of the header */
   background-size: 100% 100%; 
}


If, however, the image file is uploaded as a form resource (More > Files), the following code will position the image over the entire header size of a form with the project id 1234:

.XHeader {
   /*selects the image via relative URL to form resource*/
   background-image: url('../includes/ressource?pid=1234&name=headerbild.png'); 
   /*the positioning of the image:*/
   /*displays the image over the entire size of the header*/
   background-size: 100% 100%; 
}


Inserting as a base64-String

An image encoded as a base64-String can also be easily inserted into the CSS:

.XHeader {
   /*selects an image via base64-String*/
   background-image: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAA5SURBVBhXdY1LFgAgCAK5/6UNQ6mFzkLj4wuxkxlQDT5MSrue5onbXjKimJTUIr8rurL9Z2u+G4g4ozy8RKSwCIwAAAAASUVORK5CYII=); 
   /*the positioning of the image:*/
   background-repeat: no-repeat; /*displays the image only once*/
   background-position-x: 10px; /*positions the image horizontally*/
   background-position-y: 10px; /*positions the image vertically*/
   /*determins the image to 40px of height und the width according to aspect ratio 
      of the image*/
   background-size: auto 40px; 
   height: 60px; /*total height of the form header*/
}

The other CSS tags are used to position the image and set the height of the header.


It's important to note that when using a base64 string for image integration, the image is reloaded each time the form is called up. Web browsers don't recognize the base64 string encoded image content as a separate file, so caching mechanisms of web browsers don't work for this case.


Customizations of the typeface

The following CSS code can be used as a base to generally define the font properties for all elements in the form when using the modern theme:

.xm-form.modern *, .modern .XPage * { 
   /*selects the entire form and all pages*/
   font-family: Verdana; /*determines the default-font*/
}


The font sizes and colours for labels in input fields can be adjusted as follows:

.modern .xm-item-div LABEL {
   font-size: 14px; /*select the font-size*/
   color: #111; /*sets the font-color */
}


The font size of all input elements can be adjusted as follows:

.modern .xm-item-div *, .modern .xm-item-div .XItem {
   font-size: 14px; /* Setzt die Schriftgröße. */
}


Adding an own font

To add a new font, the font should be uploaded to the form under More > Files in the formats woff, woff2, and ttf.

However, if the font is intended for general use, it should be stored under Files & Templates > Files instead. This means that the fonts are only made available initially.


The font must then be integrated into the CSS code of a form and can then be used.


In the following example, fonts will be stored in Files & Templates > Files, identifiable by the parameter mid. For a resource in a form, the parameter pid (project id) is used instead.


After the transfer, the URLs for the fonts still need to be adapted. The absolute URL can be found on the right in the properties area.

@font-face {
   font-family: 'myfont';
      src: url('../includes/ressource?mid=8104&name=Roboto-Regular.woff2') format('woff2'),
            url('../includes/ressource?mid=8104&name=Roboto-Regular.woff') format('woff'),
            url('../includes/ressource?mid=8104&name=Roboto-Regular.ttf') format('ttf');
   font-weight:  normal;
   font-style:  normal;
}

But it is not enough to just define a font face. The new font also needs to be specified for the relevant section. This example demonstrates how to use the new font in the form header. To ensure that it functions as intended, it should be checked using the browser inspector (F12).

.modern .XHeader * {
   font-family: 'myfont';
}


Customizing the favicon

To change the favicon in a form, you can specify the position of the image to be used in the meta area of the Xima® Formcycle Designer, following this pattern: 

<link rel="shortcut icon" type="image/png" href="https://example.com/path/to/image/favicon.png" />


The integration process for a base64-coded image follows a similar approach:

<link rel="shortcut icon" type="image/png" href="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAA5SURBVBhXdY1LFgAgCAK5/6UNQ6mFzkLj4wuxkxlQDT5MSrue5onbXjKimJTUIr8rurL9Z2u+G4g4ozy8RKSwCIwAAAAASUVORK5CYII=" />


If multiple favicons with different sizes have been uploaded as form resources under Files, the corresponding code for a form with the project id 1234 and sizes of 16 x 16 and 32 x 32 pixels could look as follows:

<link rel="shortcut icon" type="image/png" sizes="16x16" href="../includes/ressource?pid=1234&name=favicon16.png" />
<link rel="shortcut icon" type="image/png" sizes="32x32" href="../includes/ressource?pid=1234&name=favicon32.png" />


Adjustment distance fieldset upwards

In the modern theme, the default distances to the upper elements are quite large. These can be adjusted using the following CSS code:

.modern .CXFieldSet .XFieldSetWrapper {
   margin-top: 5px;
}


Adjustment background color for fieldsets

To colorize the entire background of a fieldset, adjustments to the legend element are also necessary. 

Here is an example, how to do it:

.modern .CXFieldSet .XFieldSetWrapper, .modern .XFieldSet legend {
   background-color: lightsteelblue;
   width: 100%;
}


Adjustment of the side clearance

The CSS class XPage defines the spacing of a page. The first value determines the spacing for top and bottom, the second value determines the spacing for right and left:

.modern .XPage {
   padding: 25px 25px;
}


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article