Home > Web Front-end > CSS Tutorial > How to write JS and CSS in the same file

How to write JS and CSS in the same file

不言
Release: 2018-06-28 11:05:32
Original
3658 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,

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template