Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
CSS: Apply Filter of type URL() to all elements

I am trying to apply a filter to the body of my page using filter: url(#filter_id), but im not managing to make it work.

This is how im adding it to the styling:

document.body.style.filter = 'url("#filter_id")'

and this is how i am creating the filter

var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
svg.setAttribute("width","0" )
svg.setAttribute("height","0" )

var filter = document.createElement("filter");
filter.setAttribute("id","filter_id" )

var feColorMatrix = document.createElement("feColorMatrix")
feColorMatrix.setAttribute("type","matrix")
feColorMatrix.setAttribute("values","1 1 1 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0")

filter.appendChild(feColorMatrix)
svg.appendChild(filter)

document.body.prepend(svg)

this creates the filter element on the top of the body:

<filter id="filter_id">
<fecolormatrix type="matrix" values="1 1 1 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0"/>
</filter>

How can i apply it to the full page so that every element gets the color shift that i intend? For context, this is currently employed in a chrome extension im developing.

If i do other types of filters it works (applies to the full page)

document.body.style.filter = "blur(1px)"
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda