您现在的位置: 365建站网 > 365文章 > Use External CSS

Use External CSS

文章来源:365jz.com     点击数:180    更新时间:2009-09-18 10:21   参与评论
Quoted from http://www.tizag.com/cssT/external.php


What's external CSS

When using CSS it is preferable to keep the CSS separate from your HTML. Placing CSS in a separate file allows the web designer to completely differentiate between content (HTML) and design (CSS). External CSS is a file that contains only CSS code and is saved with a ".css" file extension. This CSS file is then referenced in your HTML using the <link> instead of <style>. If you're confused, don't worry. We are going to walk you through the whole process.

Example

This is a html file named index.html:

 1 <html>
 2 <head>
 3 <link rel="stylesheet" type="text/css" href="test.css" />
 4 </head>
 5 <body>
 6 <h3> A White Header </h3>
 7 <p> This paragraph has a blue font.  
 8 The background color of this page is gray because
 9 we changed it with CSS! </p>
10 </body>
11 </html>

Make sure save this file as "index.html" (without the quotes) in the same directory as your CSS file.

Why use external CSS file?

  1. It keeps your website design and content separate.
  2. It's much easier to reuse your CSS code if you have it in a separate file. Instead of typing the same CSS code on every web page you have, simply have many pages refer to a single CSS file with the "link" tag.
  3. You can make drastic changes to your web pages with just a few changes in a single CSS file.
Tag标签: CSS

如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛

发表评论 (180人查看0条评论)
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
昵称:
最新评论
------分隔线----------------------------

快速入口

· 365软件
· 杰创官网
· 建站工具
· 网站大全

其它栏目

· 建站教程
· 365学习

业务咨询

· 技术支持
· 服务时间:9:00-18:00
365建站网二维码

Powered by 365建站网 RSS地图 HTML地图

copyright © 2013-2024 版权所有 鄂ICP备17013400号