background-attachment
Baseline
åºãå©ç¨å¯è½
*
ãã®æ©è½ã¯åºãå®è£ ããã¦ãããå¤ãã®ãã¼ã¸ã§ã³ã®ç«¯æ«ããã©ã¦ã¶ã¼ã§åä½ãã¾ãã2015å¹´7æä»¥éããã¹ã¦ã®ãã©ã¦ã¶ã¼ã§å©ç¨å¯è½ã§ãã
Want more browser support for this feature? Tell us why.
* ãã®æ©è½ã®ä¸é¨ã¯ã対å¿ã¬ãã«ãç°ãªãå ´åãããã¾ãã
background-attachment 㯠CSS ã®ããããã£ã§ãèæ¯ç»åã®ä½ç½®ããã¥ã¼ãã¼ãã®ä¸ã§åºå®ããããå
å«ãããã¯ã¨ä¸ç·ã«ã¹ã¯ãã¼ã«ããããè¨å®ãã¾ãã
試ãã¦ã¿ã¾ããã
background-attachment: scroll;
background-attachment: fixed;
background-attachment: local;
background-attachment: local, scroll;
background-attachment: scroll, local;
<section id="default-example">
<div id="example-element">
London. Michaelmas term lately over, and the Lord Chancellor sitting in
Lincoln's Inn Hall. Implacable November weather. As much mud in the streets
as if the waters had but newly retired from the face of the earth, and it
would not be wonderful to meet a Megalosaurus, forty feet long or so,
waddling like an elephantine lizard up Holborn Hill. London. Michaelmas term
lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall.
Implacable November weather. As much mud in the streets as if the waters had
but newly retired from the face of the earth, and it would not be wonderful
to meet a Megalosaurus, forty feet long or so, waddling like an elephantine
lizard up Holborn Hill.
</div>
</section>
body {
overflow: scroll;
}
#default-example {
height: 600px;
}
#example-element {
max-width: 20rem;
height: 100%;
background:
url("/shared-assets/images/examples/lizard.png") right 3rem top 1rem / 15rem
no-repeat,
url("/shared-assets/images/examples/moon.jpg") center / 10rem;
color: #ff5454;
font-size: 1.5em;
font-weight: bold;
overflow: auto;
padding: 20px;
text-shadow:
0 0 0.6rem black,
0 0 0.6rem black;
}
æ§æ
/* ãã¼ã¯ã¼ãå¤ */
background-attachment: scroll;
background-attachment: fixed;
background-attachment: local;
/* ã°ãã¼ãã«å¤ */
background-attachment: inherit;
background-attachment: initial;
background-attachment: revert;
background-attachment: revert-layer;
background-attachment: unset;
background-attachment ããããã£ã¯ã以ä¸ã«æããå¤ã®ãã¡ã®ä¸ã¤ã§æå®ãã¾ãã
å¤
fixed-
èæ¯ã¯ãã¥ã¼ãã¼ãã«å¯¾ããç¸å¯¾ä½ç½®ã§åºå®ããã¾ããè¦ç´ ãã¹ã¯ãã¼ã«æ©æ§ãæã£ã¦ããã¨ãã¦ããèæ¯ç»åã¯è¦ç´ ã¨ã¨ãã«ã¯åãã¾ããã (ããã¯
background-clip: textã¨ã¯ä¸¡ç«ã§ãã¾ãã) local-
èæ¯ã¯è¦ç´ ã®å 容ã«å¯¾ããç¸å¯¾ä½ç½®ã§åºå®ããã¾ããè¦ç´ ãã¹ã¯ãã¼ã«æ©æ§ãæã£ã¦ããå ´åãèæ¯ç»åã¯è¦ç´ ã®å 容ã¨ã¨ãã«ã¹ã¯ãã¼ã«ãã¾ããèæ¯ç»åã®æç»ã¨ãªã¢ã¨é ç½®ã¨ãªã¢ã¯ãããããå²ãå¢çã§ã¯ãªããè¦ç´ ã®ã¹ã¯ãã¼ã«å¯è½ãªã¨ãªã¢ãåºæºã«ãã¾ãã
scroll-
èæ¯ã¯è¦ç´ èªèº«ã«å¯¾ããç¸å¯¾ä½ç½®ã§åºå®ãããå 容ã¨å ±ã«ã¹ã¯ãã¼ã«ãã¾ããã (è¦ç´ ã®å¢çã«å¯¾ãã¦å¹æçã«å¼µãä»ãã¾ãã)
å ¬å¼å®ç¾©
| åæå¤ | scroll |
|---|---|
| é©ç¨å¯¾è±¡ | ãã¹ã¦ã®è¦ç´ ã ::first-letterããã³::first-line ã«ãé©ç¨ããã¾ãã |
| ç¶æ¿ | ãªã |
| è¨ç®å¤ | æå®éã |
| ã¢ãã¡ã¼ã·ã§ã³ã®ç¨®é¡ | 颿£å¤ |
形弿æ³
background-attachment =
<attachment>#
<attachment> =
scroll |
fixed |
local
ä¾
>åºæ¬çãªä¾
HTML
<p>
There were doors all round the hall, but they were all locked; and when Alice
had been all the way down one side and up the other, trying every door, she
walked sadly down the middle, wondering how she was ever to get out again.
</p>
CSS
p {
background-image: url("star-solid.gif");
background-attachment: fixed;
}
çµæ
è¤æ°ã®èæ¯ç»å
ãã®ããããã£ã¯è¤æ°ã®èæ¯ç»åã«å¯¾å¿ãã¦ãããããããã®èæ¯ç»åã«ç°ãªã <attachment> ãã«ã³ãåºåãã§æå®ã§ãã¾ããããããã®ç»åã«ã¯å
é ããé çªã« <attachment> ã®å¤ãé©ç¨ããã¾ãã
HTML
<p>
There were doors all round the hall, but they were all locked; and when Alice
had been all the way down one side and up the other, trying every door, she
walked sadly down the middle, wondering how she was ever to get out again.
Suddenly she came upon a little three-legged table, all made of solid glass;
there was nothing on it except a tiny golden key, and Alice's first thought
was that it might belong to one of the doors of the hall; but, alas! either
the locks were too large, or the key was too small, but at any rate it would
not open any of them. However, on the second time round, she came upon a low
curtain she had not noticed before, and behind it was a little door about
fifteen inches high: she tried the little golden key in the lock, and to her
great delight it fitted!
</p>
CSS
p {
background-image: url("star-solid.gif"), url("star-transparent.gif");
background-attachment: fixed, scroll;
background-repeat: no-repeat, repeat-y;
}
çµæ
仿§æ¸
| 仿§æ¸ |
|---|
| CSS Backgrounds and Borders Module Level 3 > # background-attachment > |