No video

What are SVG viewport and viewBox? [ A beginners guide to SVG part 3 ]

  Рет қаралды 102,811

Kevin Powell

Kevin Powell

Күн бұрын

SVGs are strange. They have a lot of numbers and other strange stuff going on, and the viewBox can be really strange. But it's not that bad really. To understand how the viewBox works though, the first thing we need to do is understand what the SVG viewport is.
The viewport is sort of like our browser window. A website is larger than our browser window, which is why we have to scroll. SVGs are a bit like that too, we have a viewport that allows us to look at the SVG canvas. That viewport is the size of the SVG in our code, but the SVG canvas can be much larger!
The SVG viewBox is different. This is what we use to zoom in and out and pan around. The viewport stays the same. Picture opening something in Photoshop, then zooming in and panning around. You aren't changing the size of your Photoshop window at all (that's the viewport), but instead your moving items around on your screen (moving around the viewBox).
---
I have a newsletter! www.kevinpowel...
New to Sass, or want to step up your game with it? I've got a course just for you: www.kevinpowel...
---
My Code Editor: VS Code - code.visualstu...
How my browser refreshes when I save: • How to automatically r...
---
Support me on Patreon: / kevinpowell
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my KZfaq channel, make sure to follow me on Instagram and Twitter.
Instagram: / kevinpowell.co
Twitter: / kevinjpowell
Codepen: codepen.io/kev...
Github: github.com/kev...

Пікірлер: 171
@zoliky
@zoliky 5 жыл бұрын
This is, hands down, the best explanation of viewBox I've seen.
@KevinPowell
@KevinPowell 5 жыл бұрын
Thanks alot! Took me forever to even understand it myself, I'm glad I managed to figure out a clear way to explain it. It's such a weird concept.
@codewithegai
@codewithegai 2 жыл бұрын
No cap
@martefact
@martefact 2 жыл бұрын
I could not agree .more. Excellent!
@officiallydheeraj
@officiallydheeraj Жыл бұрын
I'm with you.
@AkashYadav-rj6fn
@AkashYadav-rj6fn 3 жыл бұрын
I have gotten so good in CSS it's hard to believe that. I almost followed all of your videos and Mann I feel so good I flaunt my CSS skills in front of my friends and they just get surprised everytime. Whenever any of my friends get stuck styling up something using CSS they reach out to me every single time. Kevin thanks Mann and cheers to making more such videos
@djdx2
@djdx2 2 жыл бұрын
Kevin is the god of CSS
@totalnewbie8619
@totalnewbie8619 5 жыл бұрын
Thank you for a great tutorial Mr. Powell. It is people like you that share their knowledge freely with the world that restore my faith in humanity.
@AnthonyJackman
@AnthonyJackman 2 жыл бұрын
At video time of 15:02, you mentioned this is your zoom and this is your pan with relation to viewBox. All of the bells (ding ding ding) just went off in my head. Now I get it!
@darkfuryroblox8540
@darkfuryroblox8540 4 жыл бұрын
I am a 12-year-old computer scientist and I am learning this so I can make my game. I am learning SVG graphics on LinkedIn learning and the lesson they had on SVG viewport and etc was confusing. This video makes it a lot simpler. Keep up the good work.
@8nasir7
@8nasir7 5 жыл бұрын
5:57-6:06 sums up the difference in under 10 seconds. This guy really knows how to explain. These 18 minutes are what I needed to understand in those 3 years. Thank you very much @Kevin Powell
@KevinPowell
@KevinPowell 5 жыл бұрын
So glad that the video helped you out Nasir!
@bachaplegic
@bachaplegic 6 жыл бұрын
Reminds me of hardware scrolling and sprite management when used to program on my Amiga computer back in the day. I might give svg a play. Great work, very clear.
@KayahanKahrman
@KayahanKahrman 5 жыл бұрын
Finally a clean and understandable explanition of viewBox and viewoport! This is the best explanition on the internet. Photoshop example really help a lot. Thanx and keep up the good work. :)
@KevinPowell
@KevinPowell 5 жыл бұрын
Glad that the video helped clear things up :). It's a hard concept, I'm happy that the Photoshop example worked!
@tanikobas6991
@tanikobas6991 3 жыл бұрын
Great! Now I understand view box. Because of your explanation with Photoshop!!
@vedtam
@vedtam 6 жыл бұрын
I've read over and over about the viewBox but couldn't understand until I saw your great PhotoShop example. Thanks!!!!! :)
@KevinPowell
@KevinPowell 6 жыл бұрын
Glad I could help! It is such a strange thing, even when you understand the idea behind it.
@tarek3735
@tarek3735 5 жыл бұрын
it is basically a camera view
@gregorytippett9692
@gregorytippett9692 3 жыл бұрын
Note that at 10:30, you say: "My viewport, this red box", and then shortly after state that the viewport is not the red box. Otherwise, great introduction!
@aeronwolfe7072
@aeronwolfe7072 Жыл бұрын
i really love your videos man. you're a good teacher. ive been doing web development for 20+ years, and have never sat down and really dove into svg's... lol...
@gavinm2339
@gavinm2339 11 ай бұрын
Thanks - I FINALLY get it. That ViewBox thing has really been puzzling me for longer than I'll care to admit
@ThatGuyAnonymous
@ThatGuyAnonymous 4 жыл бұрын
Great explanation as always. I don't think I could have been able to understand this without your video.
@OlehBiblyi
@OlehBiblyi 4 жыл бұрын
The best explanation about SVG
@abhimanyusharma2094
@abhimanyusharma2094 6 жыл бұрын
You are a CSS geek. Keep up the good work. :)
@nathancornwell1455
@nathancornwell1455 4 жыл бұрын
In the future, could you possibly do a series on animating SVG? I've seen some incredible things accomplished by animating SVG since you can animate individual parts of the SVG or animated borders, animated background images, etc...It's quite powerful.
@prathameshsawant5574
@prathameshsawant5574 6 жыл бұрын
Best explanation about viewport and viewbox, I was struggling with this. thanx it really helped.
@KevinPowell
@KevinPowell 6 жыл бұрын
Such a hard concept to talk about, and even harder to visualize. I'm glad that I was able to make some sense of it!
@dominiktargosz3094
@dominiktargosz3094 4 жыл бұрын
Wow, such a hard topic explained so smoothly
@KevinPowell
@KevinPowell 4 жыл бұрын
Yup, it's a strange one. I hope I did okay!
@patilyb
@patilyb 3 жыл бұрын
The best explanation of viewBox i have ever seen.
@perezshealtiel7011
@perezshealtiel7011 2 жыл бұрын
You explained the viewport and viewbox so well. Thank you.
@fervideos2011
@fervideos2011 5 жыл бұрын
Amazing explanation! it shows dedication and passion about code!!
@GuitarreroDaniel
@GuitarreroDaniel 4 жыл бұрын
I never understood that ViewBox stuff in text. This video was a god-send. Thank you very much :)
@dutu000
@dutu000 3 жыл бұрын
Best SVG viewport tutorial on KZfaq!!! Very logic and well explaned!
@Andrans1
@Andrans1 2 жыл бұрын
Nah this the best tutorial out there man.
@tallitvak5325
@tallitvak5325 5 жыл бұрын
I started learn SVG yesterday, you saved me so much time to understand so many concepts! Thank you, subscribed :)
@KevinPowell
@KevinPowell 5 жыл бұрын
Glad that I was able to help, and thanks for the sub!
@Fateslav
@Fateslav 4 жыл бұрын
Great explanation 👍 This reminds me of Google map kit where you set camera position on the map
@hasanmirarabshahi1956
@hasanmirarabshahi1956 2 жыл бұрын
Thanks, nice explanation of viewBox
@s_u_z_u9494
@s_u_z_u9494 4 жыл бұрын
This is extremely helpful, both the visuals and the explanation, and i'm officially subscribed!
@bambooindark1
@bambooindark1 5 жыл бұрын
So the concept is, viewport is the red border box you saw in this video, that red [border]-[box] thing on webpage. viewBox is a more abstract concept. You can imagine now you finished drawing a [svg image]-[work], then you draw a special translucent [rectangle]-[box] (the viewBox) on the top of your work, then you "scale up" or "scale down" the full canvas until it fit your viewport (the viewport need to "contain", not "cover" the viewBox) (if there is extra spaces, center aligned viewBox to viewport), this is what you finally see in webpage. Notice, the 4 arguments of viewBox is: startingAbsoluteX startingAbsoluteY endingRelativeX endingRelativeY (Where startingAbsoluteX + endingRelativeX = endingAbsoluteX)! Not startingAbsoluteX startingAbsoluteY endingAbsoluteX endingAbsoluteY or startingAbsoluteX startingAbsoluteY expendWidth expendHeight!
@ondrejmarek9752
@ondrejmarek9752 3 жыл бұрын
This tutorial is so helpful. Thanks.
@manohoo
@manohoo 3 жыл бұрын
Thank you, great job!
@cowcow505
@cowcow505 5 жыл бұрын
I am really happy that I found your svg series
@KevinPowell
@KevinPowell 5 жыл бұрын
I'm glad that you've found it helpful!
@DaveMcGarry
@DaveMcGarry 6 жыл бұрын
Thanks for your concise explanations... Always look forward to your videos.
@samirdanial9346
@samirdanial9346 3 жыл бұрын
I learned a lot, thank you kevien
@TerjeNesthus
@TerjeNesthus 4 жыл бұрын
Learning svg now. This video was amazing, thank you!
@markghanayem5879
@markghanayem5879 4 жыл бұрын
Very good explanation
@JuveniusDrakonius
@JuveniusDrakonius 3 жыл бұрын
amazing simple explanation, thx!
@ravikiran3455
@ravikiran3455 2 жыл бұрын
Thank you so much, its a great explanation
@christopheribault3945
@christopheribault3945 3 жыл бұрын
Merci pour cette explication grâce à laquelle j'ai enfin compris la viewBox, après plusieurs tutoriels !
@haroldmcbroom7807
@haroldmcbroom7807 2 жыл бұрын
I kind of conceptualize it as though I'm looking through binoculars, the bino's represent the "viewBox" and when I pan the bino's, changes only what I see, not what is actually there, so in retrospect, you're moving the "binoculars", not what you see through the binoculars.
@stefanw8203
@stefanw8203 4 жыл бұрын
Thank you very much for this series. Great and helped me a lot
@KavYT
@KavYT 3 жыл бұрын
This is so well explained. Many thanks! 🙏🙏🙏
@codzymajor
@codzymajor 4 жыл бұрын
Learned tons! Thank you Kevin!
@ajk7151
@ajk7151 4 жыл бұрын
excellent explanation!
@DANNFIGDESIGNS
@DANNFIGDESIGNS 4 жыл бұрын
Love your videos Kevin. Thank you. Was confusing, but not anymore. :)
@czapi03
@czapi03 5 жыл бұрын
perfect explanation! thank you mate! :)
@roberto9369
@roberto9369 4 жыл бұрын
awesome explanation man. thanks. you're a great teacher
@hugopierre3458
@hugopierre3458 5 жыл бұрын
The better explaination ever ! Thx's veryyyyy much
@fernandasalesbittencourtde1039
@fernandasalesbittencourtde1039 5 жыл бұрын
Omg, amazing video! thank you SO much! I was struggling with this but now everything makes sense =)
@lewisone
@lewisone Жыл бұрын
Hopefully we will learn how to change the viewbox numbers without having to edit the svg code. Maybe with CSS?? I'm pretty sure I could stumble through doing it with jQuery, but CSS would be dope.
@mathematician849
@mathematician849 Жыл бұрын
Great that i had this tutorial
@kissshu
@kissshu Жыл бұрын
This is very helpful.
@sqbok
@sqbok 3 жыл бұрын
Keep up your good work! It is good to know that between a lot of trash content on YT recently we can find such a pearls like your movies.
@indieNik
@indieNik 5 жыл бұрын
This clears so many things. Thank you so much Kevin :)
@EdivarSRosa
@EdivarSRosa 3 жыл бұрын
Belíssima Aula! Você é um professor fantástico! Obrigado!
@glimmbo6812
@glimmbo6812 5 жыл бұрын
Great use of photoshop as a learning aid, thanks.
@sepiaflux123
@sepiaflux123 3 жыл бұрын
excellent video!
@pnjegosh
@pnjegosh 4 жыл бұрын
Good job! Thank you very much :)
@himbary
@himbary 4 жыл бұрын
great explanation ty
@florentinahofbauer3211
@florentinahofbauer3211 4 жыл бұрын
Awesome video
@me_fault
@me_fault 10 ай бұрын
this solved my problem - thanks : -)
@soffylicous
@soffylicous 4 жыл бұрын
Great explanation! I finally get it, thank you!
@rohil3023
@rohil3023 5 жыл бұрын
So view box is basically a virtual camera within a box which can zoom in and out go left and right
@abdullahs3463
@abdullahs3463 4 жыл бұрын
Wow thank you that was amazing i was reading alot about it but did not understand much since english not my native language i was having bad time translating rather than understanding
@pdsnpsnldlqnop3330
@pdsnpsnldlqnop3330 6 жыл бұрын
It is hard to understand viewBox as a concept, I liked your reasoning for having an external stylesheet. Maybe more examples needed for viewbox, in the icon case it seems that 48x48 is a useful starting point. Then to confuse/explain, setting the 0 0 to -24 -24... This sets the origin in the middle. This is actually useful when you draw concentric circles as you know that you don't need to reposition things, or even give an x or y as the middle is in the middle... When it comes to transforms a viewbox of -24 -24 48 48 makes sense, e.g. one icon for an arrow can be rotated in the SVG to point in any direction without difficulty, or if you have drawn a complex shape you, e.g. one half of a telephone handset then you can mirror it to create the whole phone icon. Nobody has done a full tutorial of viewbox beyond having it as whatever illustrator churns out so hopefully you will be doing a viewbox 2 tutorial!!! Maybe that is going to be in the 'intermediate' series, either way I look forward to SVG episode 4.
@KevinPowell
@KevinPowell 6 жыл бұрын
I could be wrong on this, as I'm just getting into SVGs, but from what I understand, full on sprite systems were popular at one point, but inline SVGs tend to be more popular nowadays, since they lend us more control.... might be why you havent' seen a ton on them. I'll see if I can't come up with some better usecases though.
@pdsnpsnldlqnop3330
@pdsnpsnldlqnop3330 6 жыл бұрын
Currently I am trying to build an icon set for ecommerce. So there are a dozen or so that I need on every page load, e.g. add to cart, wishlist, search, view as grid/list, navigation arrows, stars for reviews and so on. I am also trying to use no presentational markup in the document, so that means HTML5 document structure rather than lots of div/span/class/id fluff in the HTML. I then style by elements rather than classes. This means lots of pseudo selectors/elements in the CSS. Which is fine, particularly since my SASS files are properly commented. I am using CSS grid all the way, so the document should be perfect for screen readers, even if the styled version shown in the browser moves content around quite a bit. Initially I had a lot of SVG tags in the document and a SVG spritesheet at the foot of the page, with this containing my icons as elements. This was going well as I could also do things in PHP to embed locale specific titles and descriptions in the spritesheet symbols. But this spritesheet was getting bigger and bigger. I also ran into persistent problems of the SVG in the document wanting to render at default 300x150 size. Not wanting to put x/y sizes in the spritesheet symbols I then independently worked out that there were advantages to the Lea Verou approach - embedding the SVG in the CSS. Everything is a compromise, and I also realised that this was not so good when it came to changing the colours of icons on hover or selected states. The symbol approach wasn't that good either when it came to that even if using currentColor for stroke/fill. Everything is a compromise and I didn't like the hacky nature of the SVGs in the stylesheet plus the filter: invert/brightness/hue-rotate way of colouring. But I do want to have no javascript as an option - so pages can download with one HTML document, one stylesheet and product images. In this way I can have an extremely speedy web page that is not re-downloading the many SVG icons with each page load. I did have a pure javascript solution that read an external SVG spritesheet and inserted it into the DOM so I only needed tags in the document. This worked very nicely and I may revisit this approach for brand logos. However, for the core furniture icons I have decided that the CSS embedded SVG stylesheet with the 'filter:' hack is the best compromise there is for my ecommerce project with SVG icons shown with ::before or ::after pseudo elements and no 'junk' in my 'pure HTML5' document. Although the project is just mine I hope to do other people's projects and therefore what I make has to be maintainable. The Lea Verou approach of having the SVG data+xml listed in the stylesheet with '\' newlines makes it maintainable enough, if not ideal as the '#' references need to be escaped as '%023'. But I can live with that and I think the next developer can too... By using the filter: invert + brightness + saturation + hue rotate 'trick' I can make fill and stroke declarations be just 'black' rather than '%023efa52e' (or whatever). If I also put the filter into a CSS variable and change that variable then I can globally style the monochrome icons consistently. So the goal of one document and one CSS file is achieved. Separation of concerns is achieved. All looks good on webkit/firefox and even edge. I can also edit the icons in the live document by using normal inspector tools and write that back into my SCSS files by using Chrome's Workspaces feature. Although I use the online SVGO tool to see what I could further optimise (e.g. merging a rotate and transform) and I do use Inkscape for doodling, I can do icons in the browser, to see them in context. I have to say that PHPstorm is actually best for drawing icons though, even though it is a PHP IDE! Inkscape doesn't let you centre the 0,0 origin in a 48x48 icon so might as well do it code style. I am getting a good 60fps with my grid layout pages at the moment but now I have the 'filter' trick as a requirement for the icons I am thinking of using that for the page links too. So that means setting links to black and then using the filter used for the CSS embedded SVG to colorise the icon text links too. Rachel Andrews usually has in her talks a few words about not using polyfills for older browsers. Since I am going for highly accessible markup with this new Grid/SVG shiny I am also taking her approach for how best to do backwardly compatible stuff. Javascript is only for progressive enhancement for my project so I am also trying to get drop-down menus to work on CSS only, with feature detection, e.g. media queries for 'pointer'. At a later stage I might put javascript back in to make the menus better, but not there yet... Regarding media queries, I have discovered that it is best to use a media query to set a variable, e.g. 'display: unset', 'display:none' to do something such as hide a 'next page' label on mobile or small screens. This results in more concise and maintainable CSS. There is some Australian guy into fluid typography who does talks including that trick. I am no longer using 'breakpoints' as such, feature detection and CSS grid is getting it to work for me, with fluid typography thrown into the mix. Spite/revenge is a good motivator - it was for Lamborghini when Ferrari would not sell him a car because he was a lowly tractor making industrialist. So my current project is 'spite' driven - I have made ecommerce projects for many people as a backend developer but not liked the frontend development aspect. So, out of 'spite' I am motivated to make something load ten times faster than anything else... The women of tech have been the main leading lights, they seem to speak my language about document structure + CSS grid whereas the men seem to be making things more complex! PWA service workers are good though, as is using mod_pagespeed to create image src-sets, but I am not interested in this frankenstein CSS written by JS stuff with every page element having ten class tags... Anyway, I must crack on, I hope my work is to be interrupted by a new video from yourself soon!!!
@pdsnpsnldlqnop3330
@pdsnpsnldlqnop3330 6 жыл бұрын
As per earlier comment, Mike Riethmuller shows how to set CSS variables to do responsive things neatly with minimal stylesheet. kzfaq.info/get/bejne/pqxgo7aox8C6aY0.html
@dasojushiva8663
@dasojushiva8663 Жыл бұрын
you are nothing less than a god!!!!
@nitishchauhan8655
@nitishchauhan8655 5 жыл бұрын
You are friggin awesome thank you
@WEBSTART-LIVE
@WEBSTART-LIVE 4 жыл бұрын
Хорошо объяснил) даже не зная языка, всё понятно!
@parasarora5869
@parasarora5869 6 жыл бұрын
I think July is gonna be svg awesome...you are awesome...keep up the good work best teacher!!✌😎✌
@yannm7800
@yannm7800 5 жыл бұрын
Just understand tht : The wiewbox is like the frame of a camera ;-)
@bernhardsmuts2265
@bernhardsmuts2265 4 жыл бұрын
Brilliant explanation!
@varleycraig
@varleycraig 4 жыл бұрын
thanks this was v useful.
@notablemind
@notablemind 4 жыл бұрын
I still don't understand why TWO numbers are necessary to control zoom in a the viewBox. If it really is "zoom" that we're trying to achieve, most other softwares control zoom with a single number. They'll say zoom factor 15, or magnifications of 100x, etc... Why does viewBox need two numbers to do zoom?
@rinatvaliullov3247
@rinatvaliullov3247 6 жыл бұрын
Thanks! Simple and not so tricky anymore for me. Can you make video about working with svg in gulp(+post-css)
@LukaszAntos
@LukaszAntos 5 жыл бұрын
Very clear explanation
@daklo9839
@daklo9839 3 жыл бұрын
This viewBox explanation was within... the viewBox
@perkin524
@perkin524 6 жыл бұрын
Thanks for these incredibly useful SVG videos - SVG was pretty much a closed book to me before. You often ask what other topics we would like to see covered so can I suggest a 'philosophical' on js frameworks. I am a longtime user of jQuery and I love that. But recently I have been studying Angular and Vue and my reaction to both is the same. After 15 minutes I'm getting really excited and thinking this is the shape of the future. After 3 hours I'm thinking this is a ridiculously complicated way to do a very simple thing. You have a steep learning curve and the final product seems to have a mass of dependencies, ten times the code, harder to understand and maintain, full of gotchas but not a bit better in terms of appearance or functionality. What is the point and how are we winning? Do you agree or can you convince us otherwise?
@KevinPowell
@KevinPowell 6 жыл бұрын
My current state of mind is use vanilla JS unless you have a good reason not to :). Vanilla JS has come a long, long way, and apart from certain specific use cases I feel like jQuery isn't as useful as it used to be. Vue, Angular and React all are more for web applications that deal with state (logged in, logged out, as a very simple example) and more complicated things like that.
@sampson1952
@sampson1952 4 жыл бұрын
Let me ask you a question to clarify my understanding. Would it be accurate to say that the "ViewBox" is analogous to the canvas on which the SVG shape is being written and the "ViewPort" is the window, sitting on top of the canvas, through which one can see the canvas??
@KevinPowell
@KevinPowell 4 жыл бұрын
That's one way to see it, yes :D
@josefbichlmeier83
@josefbichlmeier83 5 жыл бұрын
Super cool! Thanks for the explanation but it is still a super weird concept :-)
@KevinPowell
@KevinPowell 5 жыл бұрын
Totally weird! I'd love to have been a fly on the wall when they were discussing the spec and how it would work. lol
@rubik3511
@rubik3511 5 жыл бұрын
Super helpful, thank you
@rahylgetvantage7615
@rahylgetvantage7615 Жыл бұрын
Hi i have a question,first of all very comprehensive video,the thing is I made an alert svg with 300px width and 200px width and a viewBox="0 0 150 100" so how it is working that even if I change the width of my svg say 30px and 20px its the SVG fits my viewport ,it working fine but I didn't understand how it scaling itself based on the width I provided
@ifzo123
@ifzo123 4 жыл бұрын
I've noticed that Chrome doesn't display properly random hex values set on svg's "fill" and "stroke". It can only display pre-defined values like "red", "pink","green" etc..
@ifzo123
@ifzo123 4 жыл бұрын
Actually I need to be more precise: That "fill" doesn't work properly only when I use SVG object (e.g. circle) as a my cursor (e.g. instead of pointer). There is possibility to make custom cursor shape/object. But if I use SVGs Chrome does not display its color out of hex. It only takes pre-established values/colors (like "red", "blue".. etc). Have You noticed such a behavior before?
@YL3nt
@YL3nt 4 жыл бұрын
Does this also work when using SVG as symbols? Otherwise I would be writing 3 times the code for all 3 icons which sounds more redundant to me.
@gudu12321
@gudu12321 2 жыл бұрын
You're amazing!
@yaolegoleynik
@yaolegoleynik 2 жыл бұрын
Thank you
@joeyschmitz6882
@joeyschmitz6882 5 жыл бұрын
Welk explained. Thanks!
@vladyacevedo4037
@vladyacevedo4037 4 жыл бұрын
perfect explanation.
@mroze6825
@mroze6825 2 жыл бұрын
In the instance of using an image which is an svg, how would i manipulate it's dimensions and positioning? Really struggling on this and there are no videos I can find
@katty4682
@katty4682 6 жыл бұрын
So great to have a series on svg. Do you think you'll ever do something similar for canvas?
@KevinPowell
@KevinPowell 6 жыл бұрын
Nothing in the works yet, but maybe at one point.
@tokyoDrift99
@tokyoDrift99 5 жыл бұрын
Hi, first i want to thank you for the tutorial, very understandable, i'm a SVG beginner and i want to scale the svg viewbox to make it responsive how i can do ??? pls helppp
@KevinPowell
@KevinPowell 5 жыл бұрын
You could just scale the entire svg element, might be easier. Set a width for the whole thing as a percentage perhaps?
@faizyt12345
@faizyt12345 4 жыл бұрын
How to enlarge svgs that was a great tutorial
@JohnBanksTucsonAZ
@JohnBanksTucsonAZ 6 жыл бұрын
Excellent!
@franmiki
@franmiki 4 жыл бұрын
This is great
@vaaaaaaaaan8678
@vaaaaaaaaan8678 Жыл бұрын
Is it possible to set multiple veiwbox on 1 svg? I mean setting viewBox in class="twitter" and not in svg. So you can show 3 icons on seperate places?
@deafdogdesign
@deafdogdesign 3 жыл бұрын
So, can the viewbox be used to control the svg responsively?
@jitenderchand656
@jitenderchand656 5 жыл бұрын
well explained!
@ghostwebrabbi7478
@ghostwebrabbi7478 5 жыл бұрын
you save me, thank you for this nice deo
@ahsath
@ahsath 5 жыл бұрын
But if the viewBox it's infinite why we can start at 0 0?
@Gruximillian
@Gruximillian 5 жыл бұрын
Thank you for this great explanation! There's one thing I don't understand from your last example though. How can you have two or more icons displayed on the separate places on the page but have only one svg defining the icons, as you have here? Could it be done by using a and , and then add viewBox on that wraps ?
@jooom8525
@jooom8525 2 жыл бұрын
Hey, look at this easy example Each rectangle starts at another point: 0,0 ; 150;0 ; 300,0. So they are all in one svg but they don't have to start all in the upper left corner at 0,0. You can change their respective starting points and have them overlap etc. as shown in the video [A beginners guide to SVG part 2].
A beginners guide to SVG | Part One: The Why, What, and How
14:22
Kevin Powell
Рет қаралды 358 М.
黑天使遇到什么了?#short #angel #clown
00:34
Super Beauty team
Рет қаралды 45 МЛН
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 40 МЛН
SVG Viewport and viewBox (For Complete Beginners)
12:25
Envato Tuts+
Рет қаралды 27 М.
Using CSS custom properties like this is a waste
16:12
Kevin Powell
Рет қаралды 167 М.
5 CSS mistakes that I see way too often
19:03
Kevin Powell
Рет қаралды 359 М.
Understanding SVG viewBox and viewport
10:32
snorklTV
Рет қаралды 5 М.
Avoid these 5 beginner CSS mistakes
21:38
Kevin Powell
Рет қаралды 81 М.
10 Tailwind Classes I Wish I Knew Earlier
13:31
Web Dev Simplified
Рет қаралды 178 М.
You can do that with margins?
14:40
Kevin Powell
Рет қаралды 186 М.
Easily Improve Your Web Design (With Example)
17:59
Flux Academy
Рет қаралды 62 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 943 М.
黑天使遇到什么了?#short #angel #clown
00:34
Super Beauty team
Рет қаралды 45 МЛН