当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML 样式

HTML
HTML 介绍
HTML 元素
HTML 基本标签
HTML 格式
HTML 实体字符
HTML 链接
HTML 框架
HTML 表格
HTML 列表
HTML 表单
HTML 图片
HTML 背景
HTML 颜色
HTML 颜色值
HTML 颜色名
HTML 便条
HTML 布局
HTML 字体
HTML 4.0
HTML 样式

HTML 样式


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 2107 ::
收藏到网摘: n/a

With HTML 4.0 all formatting can be moved out of the HTML document and into a separate style sheet.
HTML4.0中所有有关格式化HTML文档的内容都可以分离到一个样式表中


Examples
举例

Styles in HTML[在HTML中的例子]
This example demonstrates how to format an HTML document with style information added to the <head> section.
这里演示了怎样在<head>区域中添加样式信息去格式化一个HTML文档。

Link that is not underlined[无下划线的连接]
This example demonstrates how to make a link that is not underlined, using a style attribute.
演示怎样使用style属性让连接没有下划线

Link to an external style sheet[连接外部样式表]
This example demonstrates how to use the <link> tag to link to an external style sheet.
演示怎样使用<link>标签来连接到外部的样式表


How to Use Styles
怎样去使用样式

When a browser reads a style sheet, it will format the document according to it. There are three ways of inserting a style sheet:
浏览器会根据它所读取到的样式信息来格式化文档内容。一般有三种方式来插入样式表:

External Style Sheet
外部连接样式表

An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section.
当有很多页都需要一份类似的样式表时使用外部连接是个理想的选择。你可以改变一个文件而让所有用<link>连接到此文件的网页改变外观。<link>添加在头部区域内。

<head>
<link rel="stylesheet" type="text/css"

href="mystyle.css">
</head>

Internal Style Sheet
内置样式表

An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section with the <style> tag.
一份内置样式表一般用作在一个有特殊样式的文档内。定义内置样式是在头部区域用<style>标签。

<head>
<style type="text/css">
body {background-color: red}
p {margin-left: 20px}
</style>
</head>

Inline Styles
内联样式

An inline style should be used when a unique style is to be applied to a single occurrence of an element.
内联样式可以用在要给个别元素添加样式的时候。

To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph:
使用元素中的style属性,里面为CSS 内容。下面的例子将会演示怎样去改变段落的颜色以及左编辑:

<p style="color: red; margin-left: 20px">

This is a paragraph
</p>

To learn more about styles, visit our CSS tutorial.
想要学习更多有关样式的知识,请访问我们的CSS教程


Style Tags
样式标签

Tag
标签
Description
描述
<style> Defines a style definition
样式定义
<link> Defines a resource reference
定义引用资源
<div> Defines a section in a document
定义文档区
<span> Defines a section in a document
定义文档区
<font> Deprecated. Use styles instead
不推荐。请用style替换
<basefont> Deprecated. Use styles instead
不推荐。请用style替换
<center> Deprecated. Use styles instead
不推荐。请用style替换

评论 (0) All

登陆 | 还没注册?