Home > Article > Web Front-end > How to implement css and Js code in html?
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: 080b747a20f9163200dd0a7d304ba388 selector {attribute Name 1: Attribute value; Attribute name 2: Attribute value;}531ac245ce3e4fe3d50054a55f265927
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: 080b747a20f9163200dd0a7d304ba388@import url (path to the css file);531ac245ce3e4fe3d50054a55f265927
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: 2840a3de185fface63704a94c15e7273js code2cacc6d41bbb37262a98f745aa00fbf0
The second type: first create the js file, and then reference it in the html file
Format: 50b64086077d5487fea5cd975c80dcb62cacc6d41bbb37262a98f745aa00fbf0
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!