1024programmer CSS How to embed css into html?

How to embed css into html?

   
 

Advantages:

1. The style sheet only affects one page.

2. Internal style sheets can use classes and IDs.

3. No need to upload multiple files. HTML and CSS can be in the same file.

Disadvantages:

1. Increase page loading time.

2. It only affects one page – useless if you want to use the same CSS on multiple documents.

External Style Sheets

Like HTML files, CSS files are plain text and usually have a .css file extension; Link it into the HTML file.

Features:

1), written in a separate document and then attached to various web documents

2), modifying it can affect all your Called page

3), easy to modify operations

For example, the content of the style.css file can be as follows:

body { background-color: beige; color: #000080;}
 h1 { color: red;}

Then you can use it in the header to take effect.


 

Advantages:

1. The size of the HTML page is smaller and the structure is clearer.

2. The loading speed is faster.

3. The same .css file can be used on multiple pages.

Cons:

The page may not render correctly until the external CSS is loaded.

The above is how to embed css into html? For more details, please pay attention to other related articles on 1024programmer.com!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-to-embed-css-into-html/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索