Custom CSS

In-App Custom CSS

📘

Custom CSS rules are applied to your website when it is displayed through your app. For instance within your app you may need to hide navigation elements such as a footer menu or overlay elements such as a chat widget. CSS rules added in the top section are added to both iOS and Android apps.

For example, entering the following will apply the CSS for nav, footer, and header elements to every page in your app.

.nav
{ 
    margin-top: 5px !important;
    font-size: 14px !important;
}

#header, #footer
{ 
    background-color: #4c4c4c !important;
    margin-bottom: 0px !important; 
}

Post page load JavaScript CSS

The Custom CSS embedded in your app in Website Overrides is inserted as the page is loaded within your app. For some single page web sites including WordPress these are not applied in time to be processed. In such cases you may use JavaScript after the page has completed loading to hide or show required elements. For example:

<script>
if (navigator.userAgent.indexOf('gonative') > -1) {
  $('.nav').hide();
  $('#header').hide();
  $('#footer').hide();

  // WordPress can use jQuery() rather than $()
  jQuery('.nav').hide();
  jQuery('#header').hide();
  jQuery('#footer').hide();
}
</script>

Add in the same manner as Google Analytics tags, etc Example WordPress Plugin

Server-side CSS (Advanced)

In the same way you can serve a different version of your website through your app you may also apply custom CSS rules through your server. Detect the HTTP request coming from GoNative and then serve different or additional CSS resources from your server. More info about this technique: Custom User Agent

Learn more


Next Steps