Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

background-attachment

Esta tradução não está completa. Por favor ajude a traduzir este artigo a partir do Inglês.

Resumo

Se um background-image é especificado, background-attachment determina se a posição da imagem é fixa na tela, ou rola junto com o bloco que a contém.

  • Valor inicial: scroll
  • Aplica-se a: todos os elementos
  • Herdado: não
  • Porcentagens: N/A
  • Mídia: visual
  • Valor computado: como especificado

Sintaxe

background-attachment: scroll | fixed | inherit

Valores

scroll 
Se scroll é especificado, a imagem de fundo irá rolar na tela com o bloco de imagem que a contém.
fixed 
Se fixed é especificado, a imagem de fundo não rolará com o elemento que a contém, em vez disso, continua estacionária no mesmo lugar da tela.

Exemplos

Simple example

CSS

p {
  background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif");
  background-attachment: fixed;
}

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>

Result

Multiple background image support

This property supports multiple background images. You can specify a different <attachment> for each background, separated by commas. Each image is matched with the corresponding attachment type, from first specified to last.

CSS

p {
  background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif"), url("https://mdn.mozillademos.org/files/12059/startransparent.gif");
  background-attachment: fixed, scroll;
  background-repeat: no-repeat, repeat-y;
}

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>

Result

Especificações

Compatibilidade com navegadores

Navegador Versão mais antiga
Internet Explorer 4
Firefox 1
Netscape 6
Opera 3.5

Veja também

background, background-attachment, background-color, background-image, background-position, background-repeat

Categorias

Interwiki Language Links

 

Etiquetas do documento e colaboradores

Etiquetas: 
 Colaboradores para esta página: SphinxKnight, teoli, Verruckt
 Última atualização por: SphinxKnight,