# How to Work with Styles in Webster+ (CSS)

> Source: https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster

Webster+ supports the use of CSS to enhance the appearance of Web pages generated from your applications. Below are some key points on how CSS can be used within Webster+.

Webster+ offers several methods for applying styling. Use these links to access additional information:

|  |  |
| --- | --- |
|  | **[Method 1: "CSS File URL" Option](https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster#method1):** |
|  | **[Method 2: "Custom CSS" Option](https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster#method2):** |
|  | **[Method 3: Standard Inline Styling](https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster#method3):** |
|  | **[Method 4: Short Code Option "class=xxx"](https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster#method4)** |
|  | **[Method 5: Webster+ Defined Classes](https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster#method5)** |
|  | **[Method 6: Webster+ Short Codes](https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster#method6)** |
|  | **Method 7: Standard HTML, CSS, and JavaScript** |

All custom CSS currently comes from the ***style.css*** file located on the PxPlus server.

The examples below show the various ways you can use custom styles within **Webster+ Setup** > **Customizations**.

## Method 1: "CSS File URL" Option

Much like the standard external style sheet rules, you can enter a link to the location of the external ***style.css*** file.

You must enter the full path, including **http://** (or **https://** if secure). If the path is not a valid URL, the library prefix *docroot* **/lib** will be the default directory listed for the style sheet.

Enter the URL in the **[CSS File URL](https://manual.pvxplus.com/webster/general-configuration#cssfileurl)** option. To access this option, go to **Webster+ Setup**, choose **Config** from the top menu, and then select **Customizations**.

During run time, the bind logic will add the style sheet to the page using the path you provided and include it on every page.

***Example:***

![](https://manual.pvxplus.com/migration-assets/1a6c93dfd5ff92897b0a3e59d5d1d5078174c564e29dfa8535c83ca536cd81ee.png)

## Method 2: "Custom CSS" Option

Much like the standard embedded/internal style, you can enter CSS code directly in the **[Custom CSS](https://manual.pvxplus.com/webster/general-configuration#customcss)** option.

![A screenshot of a computer](https://manual.pvxplus.com/migration-assets/3af392bebdbb71e8264c02abaf2b96b1065ef958a2cabba58b9dd713b7f09786.png)

The CSS code you enter will be appended to the current rules in the **\<style>…\</style>** section located in the **\<head>...\</head>** section.

Any rules that exist for selectors already found in the **\<style>…\</style>** section will be overridden.

During run time, the bind logic will add the style sheet to the page using the path you provided and include it on every page.

In the example below, the background of every page will now be lightblue:

![](https://manual.pvxplus.com/migration-assets/5eaf11a7481f8f852faa8af44cb885cfc0b053bca6e9013c92b2bfe497548f46.jpg)

## Method 3: Standard Inline Styling

Whether you are coding HTML in Webster+ or outside of PxPlus, inline CSS works the same way.

Inline CSS is a method of applying unique styles to a single HTML element directly within the HTML tag itself. It uses the **\<style>** attribute inside the HTML tag to declare CSS properties and their values.

Note:  
The main disadvantage of inline styling is that it applies only to the individual HTML element on a particular HTML page. If you want to use the same styles on other pages, you must copy and paste the entire \<style> block into each element on every page. This is inefficient, leads to a lot of repetitive code, and can be time-consuming.

A preferred method for defining styles is to use a separate style sheet file, reference a class or ID label, or code within the **\<head>\<style>…\</style>…\</head>** section of an HTML document.

***Syntax Example:***

\<element style="property: value; property2: value2;">Text\</element>

![](https://manual.pvxplus.com/migration-assets/378245a53185cc37ac0e35456dec8a9fe10739f0145627cd2528b5ae87cdb6b7.jpg)

## Method 4: Short Code Option "class=xxx"

Many Webster+ short codes support the short code option, **class=*xxx***. See **[Short Code Options](https://manual.pvxplus.com/webster/short-code-options)**.

This value can consist of a single class name or multiple class names, separated by spaces or commas. If spaces are used, they must be enclosed in double quotes.

***Example:***

This example applies both the **text-center** and **bold-text** styles:

\<p class="text-center bold-text">This is centered and bold.\</p>

## Method 5: Webster+ Defined Classes

Webster+ provides several dynamic classes that automatically generate corresponding CSS rules. These classes do not need to be defined in your CSS files. They will be automatically created by the binding logic and included in the page.

For descriptions of these classes including examples, see **[Webster+ Defined Classes](https://manual.pvxplus.com/webster/webster-defined-classes)**.

## Method 6: Webster+ Short Codes

Short codes are processed by a binding utility, which replaces the short codes in the HTML documents with the necessary HTML elements for rendering in a Web browser.

| **Short Code** | **Description** |
| --- | --- |
| **\[css\]…\[/css\]** | Inserts the contents of the short code into the **\<head>…\</head>** or **\<body>…\</body>** tags after any custom CSS. See **[Method 2: "Custom CSS" Option](https://manual.pvxplus.com/how-to/how-to-work-with-styles-in-webster#method2)**.<br>***Example:***<br>\<head>\[css\]body{background-color:red}\[/css\]\</head><br>\<body>\[css\]body{background-color:red}\[/css\]\</body> |
| **\[cssfile** *file=xxx*\] | Inserts a CSS file link into the **\<head>…\</head>** tags.<br>***Example:***<br>\[cssfile file=./yourstyles/buttons.css\] |
| **\[include** *filename*\] | Inserts the **\<body>…\</body>** contents of a specified file.<br>The *filename* can be either a literal (e.g. "myfile.htm") or a string variable (e.g. myfile$).<br>If *filename* is null (""), then nothing is included, and the short code is ignored.<br>***Example:***<br>\[include myfile.html\] |

## See Also

**[Short Codes](https://manual.pvxplus.com/webster/short-codes)**
