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

HTML
HTML Head
HTML Meta
HTML URLs
HTML Scripts
HTML 属性
HTML 事件
HTML URL-encode
HTML Web服务器
HTML 摘要
HTML 实例
标签列表
标准属性
事件属性
ASCII码
特殊字符
HTTP状态消息

HTML 背景


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

A good background can make a Web site look really great.
有个好的背景可以让网站看起来更棒!


Examples
例子

Good background and text color
合理的背景和文字颜色
An example of a background color and a text color that makes the text on the page easy to read.
演示了一合理运用背景色的文档可以让阅读更加容易。

Bad background and text color
比较糟糕的背景和文本颜色
An example of a background color and a text color that makes the text on the page difficult to read.
这个例子演示了不合理的颜色搭配会导致阅读上的障碍。


Backgrounds
背景

The <body> tag has two attributes where you can specify backgrounds. The background can be a color or an image.
<body>标签有两个属性你可以用来指明背景。可以是背景颜色或是图象。

Bgcolor
背景颜色

The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute can be a hexadecimal number, an RGB value, or a color name:
使用bgcolor属性可以给一个HTML页面指明一个背景颜色。其值可以是16位进制数、一个RGB值或者是颜色的名称。

<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">

The lines above all set the background-color to black.
上面的几行是都是设置背景颜色为黑色。

Background
背景

The background attribute specifies a background-image for an HTML page. The value of this attribute is the URL of the image you want to use. If the image is smaller than the browser window, the image will repeat itself until it fills the entire browser window.
背景的属性还可以是一个图象的URL地址,如果这个图象比浏览器窗口来的小,就会不断的重复,直到整个浏览器都布满。

<body background="clouds.gif">
<body background="http://www.w3schools.com/clouds.gif">

The URL can be relative (as in the first line above) or absolute (as in the second line above).
URL可以是绝对路径(第二行的)也可以是相对的(第一行)

Note: If you want to use a background image, you should keep in mind:
注意:如果你想用背景图片的,你应该时刻紧记:

  • Will the background image increase the loading time too much?
    背景图片是否在加载时花费了太多的时间?
  • Will the background image look good with other images on the page?
    背景图片和页面其他图片是否搭配?
  • Will the background image look good with the text colors on the page?
    背景图片是否和文字颜色搭配?
  • Will the background image look good when it is repeated on the page?
    背景图片重复是否看起来合适?
  • Will the background image take away the focus from the text?
    背景图片是否会导致从文字上转移视线?

Basic Notes - Useful Tips
实用提示

The bgcolor, background, and the text attributes in the <body> tag are deprecated in the latest versions of HTML (HTML 4 and XHTML). The World Wide Web Consortium (W3C) has removed these attributes from its recommendations.
在<body>标签中的背景颜色之类的属性早最新的HTML版本中是不推荐使用的,W3C组织从它们的推荐中已经去掉了这些属性。

Style sheets (CSS) should be used instead (to define the layout and display properties of HTML elements).
CSS被用来取代这些属性的作用(用来定义布局和显示HTML元素的属性)


More Examples
更多例子

Good background image
优秀的背景图片
An example of a background image and a text color that makes the text on the page easy to read.
这个案例中的背景图象和文本颜色是非常容易辨认读取的。

Good background image 2
优秀的背景图片
An example of a background image and a text color that makes the text on the page easy to read.
这个案例中的背景图象和文本颜色也息是非常容易辨认读取的。

Bad background image
糟糕的背景图片
An example of a background image and a text color that makes the text on the page very difficult to read.
这个案例中的背景图象和文本颜色是非常难于辨认读取的。


Computer Joke
计算机笑话

Support: "Type dir, space, a, colon."
打入路径、空格、a、冒号

Customer: "With a space after 'space'?"
在空格后有空格吗?

评论 (0) All

登陆 | 还没注册?