# Custom CSS

## Definition

Custom CSS refers to the organization's standardized CSS styling of each component of a webpage belonging to an application.

Every page of an application consists of the same components as illustrated in the picture below:

<div align="center"><figure><img src="https://4150968783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2jCdhU9OpCbUJl0tqSd%2Fuploads%2FJYX55Uo8plvzgHd7I9r9%2FPageExampleColored.png?alt=media&#x26;token=06e9e1ef-4a09-4d1b-b9ed-e3b144f239a8" alt=""><figcaption></figcaption></figure></div>

This article covers the description of the different components and their respective styling.

## Page Container

The Page Container refers to the main section of a webpage which contains all other sections that are listed below which are: Page Title, Toolbar and Main Body. It does not include the toolbar of the system which remains the same for all webpages of an application.&#x20;

The Page Container is styled using the following CSS classes:

```
<div class="d-flex flex-column flex-fill">
    ...
</div>
```

## Page Title

The Page Title refers to the header section of Page Container that contains the title of the webpage.

It is identified by the following CSS class:

```
div class="content-title">
    ...
</div>
```

Every webpage needs to have a Page Title.

The title is usually the same as the path leading to the webpage using ">>" to illustrate the hierarchy.

## Toolbar

The Toolbar refers to the section of Page Container that is positioned right below the Page Title. It usually contains Buttons, such as “Refresh”, “Save” or “Delete”.&#x20;

It is identified by the following CSS class:

```
div class="content-action">
    ...
</div>
```

A webpage may or may not feature a Toolbar.

### Buttons

The Toolbar often contains Buttons that trigger different events. A Button is inserted into the Toolbar in the following way:

```
<div class="content-action">
    <a id="btn-xxx" class="btn btn-primary"><i class="fa-solid fa-yyy"></i> XXX</a>
</div>
```

"XXX" denotes the name that will be displayed on the Button.

"xxx" denotes the part of the Button ID that is usually the same as the Button Name.

"yyy" denotes the part of the icon class that is derived from the fontawesome website (see previous article) to display a specific icon on the Button.

"btn-primary" is the default Button type, which is of blue color. "btn-secondary" is for less important Buttons coloring them grey. "btn-danger" colors the Button red and is only used for very important Buttons, where clicking on them may trigger an irreversible event, such as "Delete".&#x20;

## Main Body

The Main Body refers to the main section of Page Container that contains the functionality of the respective webpage.

It is identified by the following CSS class:&#x20;

```
div class="content-body">
    ...
</div>
```

Every webpage needs to have a Main Body.&#x20;

The content of the Main Body can be divided into sub-sections by using Flexible Containers as explained below. In the following, the different possible components of the Main Body will be described:

### Background

To distinguish a container from the rest of the contents, one can use the following CSS class:

```
div class="content-block">
    ...
</div>
```

It will color the background of the container white contrasting it with the default blue background of the Page Container.

### Form

Many webpages contain forms that enable the users to input data. Each item of such a form usually consists of a Label (that describes the Input) and a Control Input (that enables you to insert the Input), for example:

<figure><img src="https://4150968783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2jCdhU9OpCbUJl0tqSd%2Fuploads%2F2QHSeSae8ZL7smQyizjM%2Fimage.png?alt=media&#x26;token=a09e7214-4f2e-4253-be7e-2bde02daabb4" alt=""><figcaption></figcaption></figure>

#### Label

A Label is a text that is found next to a Control Input and specifies what kind of Input is expected to be inserted by the user, for example "Name".

All Labels are styled using the same group of CSS classes that only differ in their width, which are:

```
//Example: 100px
<table>
    <tr>
        <td class="field100">Label</td>
        <td>Control Input</td>
    </tr>
<table>

//Example: 150px
<table>
    <tr>
        <td class="field150">Label</td>
        <td>Control Input</td>
    </tr>
<table>

//Example: 200px
<table>
    <tr>
        <td class="field200">Label</td>
        <td>Control Input</td>
    </tr>
<table>
```

The number that follows after "field" specifies the width in the unit px. For example, field100 will have a width of 100px.

#### Control Input

A Control Input is a textbox, textarea or dropdown that enables the user to insert or select an Input.

All Control Inputs are styled using the same group of CSS classes that only differ in their width, which are:

```
//Example: 100p%
<table>
    <tr>
        <td>Label</td>
        <td><input type="..." class="text100"/></td>
    </tr>
<table>

//Example: 95p%
<table>
    <tr>
        <td>Label</td>
        <td><input type="..." class="text095"/></td>
    </tr>
<table>

//Example: 90p%
<table>
    <tr>
        <td>Label</td>
        <td><input type="..." class="text090"/></td>
    </tr>
<table>

//Example: 85p%
<table>
    <tr>
        <td>Label</td>
        <td><input type="..." class="text085"/></td>
    </tr>
<table>

//Example: 80p%
<table>
    <tr>
        <td>Label</td>
        <td><input type="..." class="text080"/></td>
    </tr>
<table>
```

The number that follows after "text" specifies the width in the unit %. For example, text100 will have a width of 100% relative to the parent container.

### Modal

A Modal is a small window that pops up when clicking a specific button.&#x20;

<figure><img src="https://4150968783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2jCdhU9OpCbUJl0tqSd%2Fuploads%2FUFgfAwzcE47wq8Z9Omkq%2Fimage.png?alt=media&#x26;token=8c69d5ac-3bfc-404e-8276-bd66738c7610" alt=""><figcaption></figcaption></figure>

A Modal usually consists of a Modal Body and a Modal Footer.

#### Modal Body

The Modal Body refers to the main section of a Modal that contains the functionality of the Modal, for example a Form.

It is identified by the following CSS class:&#x20;

<pre><code><strong>&#x3C;div class="modal-body">
</strong>    ...
&#x3C;/div>
</code></pre>

#### Modal Footer

The Modal Footer refers to the footer section of a Modal that may or may not contain Buttons, for example a Submit Button.

It is identified by the following CSS class:&#x20;

```
<div class="modal-footer">
    ...
</div>
```

### Flexible Containers

Flexible Containers refer to sub-sections within the Main Body of a Page Container that stretch depending on the size of the window the application is run on. There are two types of Flexible Containers, “Horizontal” and “Vertical”, that differ in their direction of stretch. Horizontal and Vertical Flexible Containers can also be used in a nested way.

#### Horizontal

Horizontal Flexible Containers are stretchable horizontally (in x-direction), i.e. their height is fixed and their width adapts to the window size (unless specified otherwise).

To realize this feature, the parent container needs to include the following CSS classes:

```
d-flex flex-row
```

And one of the children (i.e. the Horizontal Flexible Containers) needs to include the following CSS class:

```
flex-fill 
```

The complete code of a parent containing 2 Horizontal Flexible Containers as children could look like this:

```
<div class="d-flex flex-row">
    <!--Parent Container-->
    <div style="width:500px">
        <!--Horizontal Flexible Container 1-->
    </div>
    <div class="flex-fill">
        <!--Horizontal Flexible Container 2-->
    </div>
</div>
```

The following picture depicts an example of a page where the Main Body is a Vertical Flexible Container (content-body d-flex flex-row) and the two sub-sections, left and right, are Horizontal Flexible Containers:

<figure><img src="https://4150968783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2jCdhU9OpCbUJl0tqSd%2Fuploads%2FmG8qBF1tmJPxTJJ8nwmk%2Fimage.png?alt=media&#x26;token=26eec063-c692-4cd6-b3a3-9bcdbe4f7d4a" alt=""><figcaption></figcaption></figure>

#### Vertical

Vertical Flexible Containers are stretchable vertically (in y-direction), i.e. their width is fixed and their height adapts to the window size (unless specified otherwise).

To realize this feature, the parent container needs to include the CSS classes:

```
d-flex flex-column
```

And one of the children (i.e. the Vertical Flexible Containers) needs to include the following CSS class:

```
flex-fill
```

The complete code of a parent containing 2 Horizontal Flexible Container as children could look like this:

```
<div class="d-flex flex-column">
    <!--Parent Container-->
    <div style="height:500px">
        <!--Vertical Flexible Container 1-->
    </div>
    <div class="flex-fill">
        <!--Vertical Flexible Container 2-->
    </div>
</div>
```

The following picture depicts an example of a page where a Horizontal Flexible Container (d-flex flex-col) has two sub-sections, top and bottom, that are Vertical Flexible Containers:

<figure><img src="https://4150968783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2jCdhU9OpCbUJl0tqSd%2Fuploads%2F03jK6OlQribe5QVRKMKy%2Fimage.png?alt=media&#x26;token=63f6ff1e-0bb2-4f3a-83d7-6eb5afa04c45" alt=""><figcaption></figcaption></figure>

