Saturday 8 April 2017

April 08, 2017

How To Add Custom CSS Files To APEX Application

How To Add Custom CSS Files To APEX Application

CSS can be added to APEX application inline or as CSS File(s). We all know how web developers suggest on keeping the presentation, content and behaviour separately. So as a good practice for production applications, we should place all our Inline CSS in CSS files.

Depending on your requirements, you can add custom CSS Files to your application at the
  • Page Level
  • Page Template Level
  • Theme Style Level
  • Theme Level
  • User Interface Level

Uploading files to Apex


A short primer on uploading the CSS files before adding to application The first thing you need to do is storing your file in a location which can be easily available to APEX.

The files can be uploaded to APEX or placed in the Image path folder.

Uploading files to Apex can be done via the Shared Components =>  Files Section

Application Static Files
Static Application Files are local to the application as the name suggests.
Static Workspace Files are local to the workspace and thus to all application sharing the workspace.

Files placed from OS in Image Prefix directory can be accessed by all Workspaces and Applications.

When a file is uploaded to APEX, it will provide a reference like:
 #APP_IMAGES#css/fonta.min.css
 #WORKSPACE_IMAGES#css/fonta.min.css

When fonta.min.css is placed in a css folder in Image Prefix directory on the server, can be referenced as

#IMAGE_PREFIX#css/fonta.min.css

Ok, Now Lets get back to add CSS Files to APEX.

Page Level


Placing CSS File at the Page Level will restrict it only to the specific page.

For Page Level add your CSS Files reference to Page Definition =>  CSS => File URLs
APEX Page Definition CSS URL
Page Definition CSS URL

Page Template Level


Placing CSS at the Page Template Level will make the CSS available to all the pages using the specific Page Template. This can be used for specific pages to use CSS customization. However for the entire application, you will have to edit each of the Page template.

Go to Shared Components =>User Interface Section=>Themes=> Tasks list => View Templates.

Let's say I use Standard Template , So copy it and name it something like Standard Template New.
Select the name of the page template you want to edit.

Use a <link> tag within the head section to reference the appropriate style sheet.

Go to the Header Section Text area

Find #HEAD# substitution and add the following below it.


 So that its looks like below
Template Definition
Now make the Standard Template New your theme default page by going to Shared Components => Themes => Create / Edit Theme , then go to the component defaults and set your page template to Standard Template New.

Also you have to make sure that you add
 <link type="text/css" rel="stylesheet" href="#APP_IMAGES#css/fonta.min.css" >
 to each of your page templates that you would use.

Theme Style Level

This can be used to make CSS File available across the entire application. However as the name suggest the CSS Files are specific to the Style in use.

Start using another Style from Theme roller for example, and you will loose the CSS file availability.

Go to Shared Components => Themes => Create / Edit Theme => Styles Section
Apex Them Styles
Theme Styles
Go to  Settings => Files URLs and add the your CSS reference URL
#IMAGE_PREFIX#css/fonta.min.css
Apex Theme Style Definition
Theme Style Definition

Theme Level


Theme Level can be used to integrate custom font icons libraries as is suggested in the following post:

Apex 5.0 Font Awesome Integration

 Its a great way for CSS Masters to user their own font icon libraries in Apex Applications.

User Interface Level

In APEX 5 and onwards , User Interface provides a centralized place to add your custom CSS file to the Entire Application.

So no need to mess around with Themes, Page Templates and Styles.

Just add as following:

Go to Shared Components =>  User Attributes  => Edit User Interface =>  CSS File URLs Section
APEX User Interface Attributes
User Interface Attributes


APEX User Interface Edit
User Interface Edit


APEX User Interface CSS URL
User Interface CSS URL



A reev a dérchi for now.

10 comments:

  1. Hi Tuấn Phát Nguyễn Minh,
    ask your question

    ReplyDelete
  2. This is pretty awesome. But, doesnt work when you set your background image from a static files too... Do you know a workaround?

    ReplyDelete
  3. A nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.

    Hadoop Training in Chennai

    Base SAS Training in Chennai

    MSBI Training in Chennai

    ReplyDelete
  4. Thanks a lot sir. I was tired to found the use external CSS file in apex. But now it solved.

    ReplyDelete
  5. Hello,
    Can I hide title bar from page. Please let me know CSS coding and at which place it will be added.
    Thank you
    ASIF IQBAL

    ReplyDelete
  6. Awesome work, If you need any online converter then use this;

    Files Converter Online

    ReplyDelete
  7. Iam so thrilled because of finding your alluring website here.Actually i was searching for Oracle APEX.Your blog is so astounding and informative too..Iam very happy to find such a creative blog. Iam also find another one by mistake while am searching the same topicOracle SOA.Thank you soo much..

    ReplyDelete
  8. I cannot thank you enough for the blog.Thanks Again. Keep writing.
    devops online training
    devops training

    ReplyDelete
  9. how do you use the tags in the apex form?

    ReplyDelete