Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

how to make responsive svg

const svg = document.querySelector('svg');

svg.style.height = `${window.innerHeight}px`;
window.addEventListener('resize', () => { // for every screen resize, the svg height remains 100% relative to the window height
  svg.style.height = `${window.innerHeight}px`;
  console.log(window.innerWidth)
});
Source by thenewcode.com #
 
PREVIOUS NEXT
Tagged: #responsive #svg
ADD COMMENT
Topic
Name
1+8 =