CSS bounce problem when page refreshes

Source: Internet
Author: User
Objective

Today in doing JSP refactoring, there is a JS method (called it a method bar) there is a Reload page statement, before refactoring, there was no problem executing the statement of the A method, but today, after I refactor some of the content, I execute the A method again, and the entire page's CSS layout jumps randomly, The user experience is not very effective. Solving Method

By searching for answers in Baidu, Google, got an answer: said is because in the JSP page has written the CSS style and the JS statement reason, I have tried a bit, will own writes the CSS to put in a CSS file, uses the <link> to introduce, will own writes the JS to also put in a JS file, with <script> introduced to.
code example:

Introduction of JS file:
<script src= "/resources/script/project_list.js" ></script>
introduction of CSS file:
<link rel= "Stylesheet" href= "/resources/css/project_list.css" >

The result is really solved ... Conclusion:

As for why, I can only guess: the style sheet written on the page will load after the page's HTML element appears, and the imported words will be loaded first. Not how to learn the front end, the basic knowledge of the front-end lack, there are know the principle of Bo friends also please enlighten, thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.