How to write JS and CSS in the same file

不言
Release: 2018-06-28 11:05:32
Original
3531 people have browsed it

This article mainly introduces the writing method of writing JS and CSS in the same file. It has a certain reference value. Now I share it with you. Friends in need can refer to it.

We often Merge multiple CSS or multiple JS into one to save requests, but at least two are still required. I saw on the MSDN Blog that it is possible to combine JS and CSS in one file. How to do it? Using comments, take a look at the code first.

<!-- /* 
window.onload=function(){ 
document.getElementById("test2").innerHTML="传说中滴JS测试者。如果你看到我,那<strong>JS</strong>也生效了"; 
} 
<!-- */  
<!-- #test1,#test2{border:3px #000 solid;padding:5px;color:#123456;background-color:#ccc;} strong{color:red;}
Copy after login

When CSS is processed,