CSS引入
2016-05-22 16:03
761 查看
<!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> <!-- html 在一个网页中负责的事情是一个页面的结构 css(层叠样式表) 在一个网页中主要负责了页面的数据样式。 编写css代码的方式: 第一种: 在style标签中编写css代码。 只能用于本页面中,复用性不强。 格式 : <style type="text\css"> 编写css的代码。 </style> 例子: <style type="text\css"> a{ color:#F00; text-decoration:none; } </style> 第二种: 可以引入外部的css文件。 推荐使用。 方式1: 使用link标签。 推荐使用... 格式: <link href="css文件的路径" rel="stylesheet"> 例子: <link href="1.css" rel="stylesheet"/> 方式2:使用<style>引入 格式: <style type="text/css" > @import url("css的路径"); </style> 例子: <style type="text/css" > @import url("1.css"); </style> 第三种方式:直接在html标签使用style属性编写。 只能用于本标签中,复用性较差。 不推荐使用。 例子: <a style="color:#0F0; text-decoration:none" href="#">新闻的标题1</a> --> <style type="text/css"> /* html的注释:<!-- html的注释 --> css / css的注释 ..*/ /* */ </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <h1>标题1</h1> <a style="color:#0F0; text-decoration:none" href="#">新闻的标题1</a> <a href="#">新闻标题2</a> <a href="#">新闻标题3</a> <a href="#">新闻标题4</a> <a href="#">新闻标题5</a> <a href="#">新闻标题6</a> </body> </html>
相关文章推荐
- 5.css字体
- CSS 背景background实例
- (6)css盒子模型(基础下)
- Flexbox布局(2)
- CSS属性集合
- CSS3-过渡属性,CSS3-动画
- Chapter 2. HTML---CSS样式表(格式与布局)
- 【HTML/CSS】浮动结构深入浅出
- CSS伪类选择器 -- nth-child(an+b):
- pyspider 爬虫教程(一):HTML 和 CSS 选择器
- css伪类 伪元素
- 写css的一些小技巧
- css display table-cell
- css 10 款非常棒的CSS代码格式化工具推荐
- CSS代码格式化工具
- css初始化代码合集
- 4.css度量单位
- 3.css中的颜色
- css选择器-属性选择器
- HTML- css多列布局