Descrição
background-attachment determina o contexto de tiling e o estado de rolagem de uma imagem de fundo.
Valores possíveis
scroll - Uma imagem de fundo definida para rolar irá rolar junto com o resto do documento.
fixed - Uma imagem de fundo definida como fixa permanecerá travada no lugar enquanto o restante do documento rola.
Aplica-se a
Todos os elementos HTML.
Sintaxe DOM
object.style.backgroundAttachment = scroll | fixed;
Exemplo
<html>
<head>
</head>
<body>
<p style = "background-image:url(/images/logo.png); background-attachment:scroll; background-attachment:scroll; background-repeat: no-repeat; background-attachment: fixed;">
This parapgraph has scrolling background image.
This parapgraph has fixed repeated background image.
This parapgraph has fixed repeated background image.
This parapgraph has fixed repeated background image.
This parapgraph has fixed repeated background image.
This parapgraph has fixed repeated background image.
</p>
</body>
</html>
Isso produzirá o seguinte resultado -