How to combine css and html:
The first way: There is an attribute style in each html, and write the css code in the style attribute
Format: style="Attribute name 1: attribute value; Attribute name 2: Attribute value;"
Example:
<div style="background-color:red;color=black;">第一种结合方式</div>
Second: Use html tags to implement
Format:
Example:
<style type="text/css"> div { background-color:red; } p { color:blue; } </style>
Third method: First create a css file and write css code in the css file , secondly implement the
format in the tag of the html file:
The fourth way: introduce external Resource files, use the header tag link to implement
Format:
<link rel="stylesheet" type="text/css" href="css的路径"/>
Combination of js and html:
First method: use html tags
Format:
The second type: first create the js file, and then reference it in the html file
Format:
The above is the detailed content of How to implement css and Js code in html?. For more information, please follow other related articles on the PHP Chinese website!