0

I am working in node.js and using ejs for my front end programming. While loading the page, it displays all the content in an unmanaged way but after loading the CSS its show correct layout.

Is there a way to load the CSS first so that the page shows / loads correctly? I heard that there is a way related to async, although I don't know how to use the function properly.

2
  • can be in jquery? the answer? Commented May 10, 2016 at 11:26
  • yeh please tell me Commented May 10, 2016 at 11:27

2 Answers 2

1

Put

<link href="/public/css/simple-sidebar.css" rel="stylesheet">

in begining of HEAD, and CSS will load before page will render

Sign up to request clarification or add additional context in comments.

Comments

0

1 - hide all the page

<body style="display: none;">

2 -With jQuery show all, when all files are loaded:

<script>
$(window).load(function() {
  $("body").show();
});
</script>

or jQuery instead $:

<script>
jQuery(window).load(function() {
  $("body").show();
});
</script>

3 Comments

its working but its take too much time is there a way to show the loader in this because blank screen look weird
maybe create a loading ? what do you think?
i am thing i want loader can we add?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.