Search
 
SCRIPT & CODE EXAMPLE
 

HTML

responsive svg image in html

/* responsive svg */
/* NOTE: remove default width and height and replace it with values in viewbox */
<svg version="1.1" viewBox="0 0 500 500">
	<circle fill="#F7941E" stroke="#231F20" stroke-width="10" 
	cx="250" cy="250" r="200" opacity="0.6" />
</svg>
Comment

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)
});
Comment

PREVIOUS NEXT
Code Example
Html :: ion input file 
Html :: html login and registration form 
Html :: how to increaase font size on html 
Html :: html faq 
Html :: scroll to a section of your page html 
Html :: prevent modal from auto closing when clicked away 
Html :: html css how to position elements on right of div 
Html :: html js script 
Html :: bootstrap country flag dropdown 
Html :: html instagram 
Html :: progress bar bootstrap 5 
Html :: dl in html 
Html :: input range event 
Html :: allow multiple select on radio button in html 
Html :: bootstrap 4.5.3 
Html :: html deactivate scrolling 
Html :: html chart 
Html :: storybook fonts 
Html :: html make an alert for delete 
Html :: use js variable in form action 
Html :: bootstrap 5 cdn 
Html :: intput field submit button 
Html :: typo3 headerdata 
Html :: html input for email 
Html :: prefetch tag 
Html :: status 201 
Html :: html variables 
Html :: React Css Class Module 
Html :: what is defer in html 
Html :: how to resize all images in a class html 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =