Home >Web Front-end >CSS Tutorial >How to reference CSS files into html web pages
Methods to reference CSS files into HTML web pages: 1. Embed CSS styles directly in HTML tag elements; 2. Use the style built-in style in HTML; 3. Use [@import] to reference external CSS files .
The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.
How to quote CSS files into html web pages:
1. Embed css styles directly in html tag elements, such as <div style=" font-size:14px; color:#FF0000;">I am div css test content-www.divcss5.com supports<code>
2. Insert the style statement code in the head part of the html header as follows:
<style type="text/css"> <!-- .ceshi {font-size:14px; color:#FF0000;}/*这里是设置CSS的样式内容*/ --> </style>
The specific method is as follows:
3. Use @import to reference external CSS files
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>css引用方法实例-www.divcss5.com测试实例</title> <style type="text/css"> <!-- @import url(wcss.css);/*这里是通过@import引用CSS的样式内容*/ --> </style> </head> <body> <div class="ceshi">我是div css测试内容www.divcss5.com支持</div> </body> </html>
Recommended related tutorials: CSS video tutorial
The above is the detailed content of How to reference CSS files into html web pages. For more information, please follow other related articles on the PHP Chinese website!