在本文中,我们将看到如何在 CSS 中指定固定背景图像。为了在 CSS 中保持背景固定、滚动或本地化,我们必须使用 background-attachment 属性。
Background-attachment:此属性在 CSS 中用于将背景图像设置为固定或滚动。此属性的默认值是滚动。
背景附件属性的值:
- 滚动:它是背景附件属性的默认值。它用于与背景页面一起滚动图像。
- 固定:背景图像不会滚动。它是用页面固定的。
- 本地:背景图像将随内容滚动。
要保持背景图像固定,您必须使用值为 Fixed 的 background-attachment 属性。
句法:
background-attachment: fixed;
例子:
HTML
Example for fixed Background Image
Paragraphs are the building blocks
of papers. Many students define
paragraphs in terms of length: a
paragraph is a group of at least
five sentences,
a paragraph is half a page long,
etc. In reality, though, the unity
and coherence of ideas among
sentences is what constitutes a
paragraph.
A paragraph is defined as “a group
of sentences or a single sentence
that forms a unit” (Lunsford and
Connors 116).
Length and appearance do not
determine whether a section in
a paper is a paragraph.
For instance, in some styles of
writing, particularly journalistic
styles, a paragraph can be just
one sentence long. Ultimately, a
paragraph is a sentence or group of
sentences that support one main idea.
In this handout, we will refer to this
as the “controlling idea,” because it
controls what happens in the rest
of the paragraph.
输出: