Home > Web Front-end > JS Tutorial > How to implement css and Js code in html?

How to implement css and Js code in html?

零下一度
Release: 2017-07-03 09:12:05
Original
1565 people have browsed it

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>
Copy after login

Second: Use html tags to implement
Format:
Example:

<style type="text/css">
                div {
                        background-color:red;
                }
                p {
                    color:blue;
                }
        </style>
Copy after login


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的路径"/>
Copy after login

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!

Related labels:
source:php.cn
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