A brief introduction to JS and CSS Inline Outreach considerations _ Basics

Source: Internet
Author: User
Tags html tags

Simply put : These two problems are actually the same problem, but find a long time on the internet can not find a way, the outside of the JS and CSS files can not have any HTML markup annotation, once there, the browser is crazy! Just remove it,!!!.

question : The cause is the net sees a CSS form style, feels very good-looking, plans to put in own ASP.net program, at the beginning I put in the aspx file, displays the normal

Then I'm going to put CSS and JS in a separate file, this time the browser went crazy, the display effect is completely different from the original inline, as if not to see my CSS style sheet, but some of the style has been executed, and some of the style is ignored, For example, the thead of the table head is performed well, but the table border is forced to 2px; it's a little annoying to be bothered by a small problem!

Solution : The solution is actually very simple, the JS and CSS files in all HTML tags <>, comments <!----, all removed, and then OK!

analysis : Last night looked into the relevant data mentioned that "the browser does not find the relevant style sheet, it will invoke its internal CSS rendering parameters to work",

Pictured above: "Graphic CSS3: Core technology and Case study", this book is currently one of the few CSS3 books, although the electronic version, but consider will buy a book!

With the browser from the developer tool to see, it is so, it can not explain the time, it calls the browser itself with the rendering parameters, the following-webkit-the beginning of the two paragraphs , the table's border set for 2px;

Look at your own JS file, this pair of HTML tags to remove <script type= "Text/javascript" ></script> on OK, inside the <!----> annotation tags can be retained;

Take a look at your own CSS file, which has <!--CSS goes in the document head or added to your external stylesheet-->,css style file even HTML annotations can not have, otherwise CSS is part of the explanation of the strange phenomenon, a remove also good, really too suppress, the original own mistake is this small annotation caused.

So how do css files write comments? With C annotation method can be/* Comment * *

The above article on JS and CSS inline joint attention is small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.

Related Article

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.