Home > Article > Web Front-end > How to reference css in html? There are several ways to reference css in html
How to introduce css into html? What are the ways to introduce css into html? How to reference css files? These questions are very unfamiliar to novices who have just started using CSS. So how does html reference css? How many methods are there for html to reference css? Let’s summarize it below.
1: How to reference CSS in HTML? There are several ways to reference CSS in HTML [Recommended reading: How to reference CSS to HTML里】
1. Use css style in div to apply css style
2. Use style in html to reference
3. Use @import to reference external css
4. Use link to reference css files
2: Example of html reference css method
1. Directly reference the css style in the element in the html tag, for example:
<div style="font-size:14px; color:#FF0000;">
2. You can also put the style style in the html header, for example:
<style type="text/css"> <!-- .ceshi {font-size:14px; color:#FF0000;}/*这里是设置CSS的样式内容*/ --> </style> 3.使用@import引用外部CSS文件方法,例如: <!-- @import url(wcss.css);/*这里是通过@import引用CSS的样式内容*/ -->
4. Use link to call external css files
Place a file in the head header, which describes Call the external wcss.css file to implement the html reference css file.
The above is a complete introduction to how to reference css in html? There are several ways to reference css in html. If you want to know more about HTML tutorial, please pay attention to php Chinese website.
The above is the detailed content of How to reference css in html? There are several ways to reference css in html. For more information, please follow other related articles on the PHP Chinese website!