Front End Center - Why Inline SVG is Best SVG

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • SVG is one of the most powerful tools in a front-end developer's arsenal, and while its browser support is excellent, there's enough rough edges that a lot of people consistently reach for an alternative such as icon fonts, static images or CSS-only drawing techniques.
    In this episode we'll look at what can be achieved by writing SVG by hand, simple effects that can add a lot to an interaction that only need a handful of lines of SVG + CSS. But we'll also consider why it is that Inline SVG, in particular, is so much easier to work with than embedding SVG in other ways.
    Want to see more? Subscribe at frontend.center

Комментарии • 147

  • @nurbekamanbekov9824
    @nurbekamanbekov9824 2 года назад

    One of the most underrated channels I've ever seen

  • @enochappathurai
    @enochappathurai 7 лет назад +3

    This is the "SVG is awwwsome" talk I've been needing. Great work mate

  • @Dxpress_
    @Dxpress_ 4 года назад +26

    10:56
    Years of query-selecting elements and logging them to the console for testing, and I had no idea you could just do this.

  • @skettdog
    @skettdog 3 года назад

    God damn I am so glad I clicked this. I have consumed many articles and videos on web development since I started learning 2 months ago, but this was the best by far. I am finally able to wrap my head around so many things which were confusing about SVG before.

  • @terehovsergej
    @terehovsergej 7 лет назад

    Excellent! thanks

  • @1001-w5q
    @1001-w5q 4 года назад

    I don't understand how line appears right below the input field and has the same width while my line appears righter or bigger than input form

  • @humanperson8418
    @humanperson8418 2 года назад

    Why draw 2 identical lines, when all your doing is changing the css?

  • @thekaleb
    @thekaleb 7 лет назад +53

    Why Front End Center video is best video.

  • @MaximeRouiller
    @MaximeRouiller 7 лет назад +27

    Mind blown. Dude... you're insane. I love it!

  • @Naz-yi9bs
    @Naz-yi9bs 2 года назад +1

    Wow I wish you made a tutorial on how to go from newb to pro in SVG... you're teaching style is amazing.

  • @svgsprite4942
    @svgsprite4942 5 лет назад +1

    Utility to make sprites: goo.gl/sDpdEh ✨

  • @awekeningbro1207
    @awekeningbro1207 4 года назад +1

    Please explain how is this simple? This is basically advanced CSS and this is complicated.

  • @adarshverma4599
    @adarshverma4599 3 года назад +2

    This just blows my mind! It makes me realise how superficially I know about SVG. Great Video 👌

  • @ozzyfromspace
    @ozzyfromspace 5 лет назад +1

    This video was a surreal reminder that I don't know shieeyyt. Oh well, still a great video 🙌🏽

  • @pradipspeaks9395
    @pradipspeaks9395 6 месяцев назад

    Very nice ❤
    If I have a svg file (a.svg) how can I easily, without any overhead, can translate to an inline svg in my React js ?

  • @mustache2295
    @mustache2295 4 года назад

    Is this still applicable today? Just discovered SVG and not sure what to do from here other than make some cool stuff and try to put it into websites. At first I thought of just creating my own images but then I thought... Well, why not make some awesome animations as well.

  • @asif-rahaman
    @asif-rahaman 4 года назад

    Wow, very good quality tutorials. Why did you stop making videos?

  • @4.0.4
    @4.0.4 6 лет назад +1

    Wow, this guy is so concise and sharp! And also bringing in good content!
    You can tell there was a well-written script. Can't shut the brain for a second or you'll miss something. Great for actually paying attention.

  • @bluesprodeep2079
    @bluesprodeep2079 3 года назад

    At 16:14, why do you move the svg to below the input and later set an order:-1 to show the svg ahead of the input again? why not just leave it ahead the input in the first place?

  • @nicolasparada
    @nicolasparada 7 лет назад +7

    Very interesting. I have one question about performance. I've always heard that you should only animate opacity and transform on CSS because they are optimized and bla bla bla... Are those stroke-dasharray and stroke-dashoffset safe to animate without impact on the performace?

    • @FrontEndCenter
      @FrontEndCenter  7 лет назад +10

      A good rule of thumb when it comes to performance is "how many pixels are getting redrawn?". With big objects, you do have to be careful so only using transform and opacity is a good idea. But if you're animating small things (and those animations don't affect the layout of the rest of the page) then you can pretty much do what you like!
      Check D3's examples page to see just how smoothly SVG can be redrawn, even at larger sizes: github.com/d3/d3/wiki/Gallery

    • @nicolasparada
      @nicolasparada 7 лет назад +1

      Ok, thanks for the advice.

    • @keanukentgargar5743
      @keanukentgargar5743 5 лет назад +1

      @6:08 what’s that plugin called that shows arrows which indicates it is newline?

    • @keanukentgargar5743
      @keanukentgargar5743 5 лет назад

      wrong thread haha

  • @avimehenwal
    @avimehenwal 4 года назад +1

    OMG .. this video is an eye opener. I never knew we can do so much with SVG.
    Thankyou so much for sharing

  • @blendjams
    @blendjams 4 года назад

    how much will the svg affect the overall size of the websites as compared to plain css?

  • @realdaly
    @realdaly 6 месяцев назад

    I can't believe this tutorial is 7 years old!

  • @LambdaJack
    @LambdaJack 3 года назад

    Pushing Pixels until it works^TM!!

  • @supersjaak123
    @supersjaak123 5 лет назад +1

    Jesus Christ what high quality content. I wish I discovered this channel when I was still in school studying for web design & development.

  • @danieldante8341
    @danieldante8341 6 лет назад +1

    There's a special place in heaven for people just like you :)
    Great explanation! Subbed!

  • @sujanlimbu4540
    @sujanlimbu4540 4 года назад

    which theme you are using, also which font

  • @javascript_developer
    @javascript_developer 3 года назад

    How are you able to show output at the same time you write css without having to save ?

  • @jhbloom1
    @jhbloom1 7 лет назад +1

    You can recreate the same bottom border animation using CSS pseudo elements and animation... avoids having to make a mess of the HTML structure.
    While inline SVG has the most power, it also potentially litters the structure with purely presentational elements.
    Don’t get me wrong, I liked the SVG explaination. It was just clear that semantics was not part of this video... no paragraphs grouping form labels and inputs (W3C) and the redundancy of inputs with the class of input and labels with the class of label. An OOCSS methodology here seem overkill for the scope of this particular project/demo. More semantic selectors might have allowed for again a less cluttered and streamlined markup.
    Just some fuel for though...

    • @cyberpsybin
      @cyberpsybin 6 лет назад

      semantics is nonsense when you consider the way modern front end is written with all the JS, CSS frameworks.

  • @chrishansen4163
    @chrishansen4163 6 лет назад +1

    When you make edits, PLEASE SLOW DOWN. You're a wizard with your editor so I had to pause and rewind like a million times to understand what edit you just made. Making it a little unpleasant. Great content though, have already implemented new knowledge into projects. Thanks.

    • @quiubolecab
      @quiubolecab 5 лет назад

      Maybe you can set the video speed to 0.75.

  • @JayRGabz
    @JayRGabz 3 года назад

    thank you for this... I love it...

  • @adventure-007
    @adventure-007 4 года назад

    Liked. Subscribed. Dinggggg ALL

  • @JayRGabz
    @JayRGabz 3 года назад

    please create more svg videos...

  • @oussamabouchikhi8110
    @oussamabouchikhi8110 4 года назад

    What is font used in pink color?

  • @wicek3d
    @wicek3d 7 лет назад +3

    Fantastic. Thanks a lot for this simple and powerful example! :)

  • @goncalodumas
    @goncalodumas 3 года назад

    Great asset, instant subscriber!

  • @bluesprodeep2079
    @bluesprodeep2079 3 года назад

    This is awsome. Thank you!

  • @Velenir
    @Velenir 7 лет назад

    You can control svg inside object, embed, with yourObject.contentDocument.querySelector("svg") as long as everything is same-origin.

  • @randommode3016
    @randommode3016 3 года назад

    4:01 benefits of inline svg💚

  • @mykelchang846
    @mykelchang846 5 лет назад +1

    Great stuff, thank you ;)

  • @MindGem
    @MindGem 4 года назад

    Make a video where you show how to manipulate external svgs. I've been struggling with that for a long time. It needs to be a complex svg, say a character with lots of different elements with their own ID's. So far I've manage to change simple solid fills but not gradients on runtime. It's also annoying since I have to upload the files to the server every single time I make a change because of cross origin, I don't know if you can fake that with a desktop server solution. Anyways. Do a video on that.
    Alternatively. Show a way to have inline complex svgs where you have more control. My problem would be that I don't understand where to put them because 1 single svg is thousands of lines of code and I need to pull in hundres of them for my project. So is there a simple way to store them inline so to speak?

  • @kadekeqw23
    @kadekeqw23 5 лет назад +1

    Diamond quality.

  • @seydinabadiane8761
    @seydinabadiane8761 3 года назад

    just insane dude !!!!!!

  • @KinTuza
    @KinTuza 7 лет назад

    I was hoping that you'd explain "Viewbox". I'm having a problem with media icons that I put under my nav div. I thought that the ul was at fault since it is inherently 100% in width. Even that won't help. WELP!

  • @zeeshanofficial3621
    @zeeshanofficial3621 4 года назад

    sir waiting for new tuts...
    kindly make it 4 videos per month...
    so it will be 1 over a week...
    15 days of wait for a video is very long

  • @Tommersable
    @Tommersable 5 лет назад

    Watched for about 5 minutes. This channel is gold. Get back to making video content already.

  • @natelawrence
    @natelawrence 3 года назад

    Hi, Glen, I'm wanting to create a fansite for the web series, Chrontendo. As a part of that, I'd like to use web standards to recreate his wordmark/logo.
    He uses Georgia Pro Bold with some simple text shadows, which are simple enough to replicate.
    I've been stuck for over half a year now on the fact that he uses what Adobe Illustrator would call an 'Envelope Distort' effect on the text.
    I re-created the effect as a baked SVG image last year, but would love to have this be dynamic on the site so that if someone translates the page, the logo is translated along with the rest of the page with the 'fisheye lens' effect intact.
    If you could illustrate how to do this, I would be most grateful.
    Please contact me if I can pay you for a solution to this challenge.

  • @sanchariBahubali
    @sanchariBahubali 3 года назад

    great video.. u deserve a million subscribers for your teaching style. soon u will hit that number

  • @jenoyestewart1516
    @jenoyestewart1516 6 лет назад

    I am new to this channel and this is the first video that I'm watching from your channel but I am blown away. In that vein, is there any reliable resource online for learning these things about SVG as you have just demonstrated (granted most things will come with usage and experience)?

  • @ryanmcpherson6167
    @ryanmcpherson6167 4 года назад

    Satisfied and Jealous at the same time. How is that possible?! Liked and Subscribed.

  • @meagar
    @meagar 7 лет назад +2

    I thought this channel was dead, glad to see that I was wrong.

  • @nizamuddinshaikh3185
    @nizamuddinshaikh3185 3 года назад

    What a power Inline SVG has got! Thanks for sharing. 👍😃

  • @kjvisual7
    @kjvisual7 6 лет назад

    This video introduced me to what is possible with SVG. Wow. And I was only looking for a video that explained the benefits of using SVG inline. SVG is like a whole new world of code to learn. Especially if I consider that it was intended to be like Flash. Hmmm what is possible, what can SVG really do? Thanks 😀

  • @natashakamokaba9574
    @natashakamokaba9574 4 года назад

    Completed wireframing in xd and exported to html. Backend mostly came with svg tags that got me confused. Your tutorial helped. More videos on SVG would be great. Thank you sir.

  • @dawidpomioto1595
    @dawidpomioto1595 4 года назад

    Before I ignored all the stuff about inline svg and I just copy pasted intro my projects, but your video inspired me to really master inline svg. I was study it for 2 weeks and I memorized all the commends for drawing, filters , masks, different kinds of animations, I learned JS dom and few JS libraries. and other stuff related. At the end I came back to your video to make sure I understand everything you presented, and I still learn something new. Thank you for making this video!

  • @berakoc8556
    @berakoc8556 4 года назад

    A lovely british accent and awesome tutorial. Just the way I like it.

  • @brianevans4
    @brianevans4 3 года назад

    would be interesting to see more usage of inline SVG in frameworks like react. Anyone know of a good npm package that helps with using svg in react?

  • @HarpreetSingh-cz2zh
    @HarpreetSingh-cz2zh 6 лет назад

    Hello, as mentioned in your video - you said there will be a javascript version for svg.. any updates on that? Excited to learn!

  • @sam.kendrick
    @sam.kendrick 7 лет назад +1

    Thanks for your time and effort! I learned about more than SVGs in this video!

  • @길병찬학부생-소프트
    @길병찬학부생-소프트 6 лет назад

    Amazing!
    Also impressed by the way of your editing video. What is the name of video editing program by the way?

  • @zer0ne83
    @zer0ne83 6 лет назад

    Good stuff mate. Cured me of my subconscious avoidance of SVG usage. Admittedly had no idea they could do even half of that. Thought SVG was an STD your CSS could catch by having unprotected sex with PNGs. The more you know, eh? ;)

  • @tough_year
    @tough_year 4 года назад

    thanks a lot

  • @doktoren99
    @doktoren99 4 года назад

    Exquisite!

  • @keanukentgargar5743
    @keanukentgargar5743 5 лет назад

    @6:08 what’s that plugin called that shows arrows which indicates it is newline?

  • @RikGierman
    @RikGierman 4 года назад

    Awesome!

  • @autorashades1984
    @autorashades1984 5 лет назад

    Good info thanks. I like the idea of using an or object [contenteditable]

  • @mightyjoetech
    @mightyjoetech 7 лет назад

    I enjoyed the first video so much, I might buy 1 month.

  • @RuudBurger
    @RuudBurger 7 лет назад

    Making the borders with SVG and the dasharrays seems overly complicated. You can just do a scaleX from 0 to 1 to get the same effect. Easier to animate when width is unknown too. Moving the transform origin (which is centered by default) you can make it grow from anywhere in the line.
    Also "svg is simpler, because it has no z-index, it just renders top to bottom". Yeah, that is how dom works also by default.
    Good talk for the rest of the video though!

  • @flwi
    @flwi 4 года назад

    Great tutorial! Thanks for sharing!

  • @alexandrebrunoalvarenga8862
    @alexandrebrunoalvarenga8862 3 года назад

    up

  • @impankratov
    @impankratov 7 лет назад

    Great dasharray & dashoffset explanation, thanks!

  • @leonardodiaz9052
    @leonardodiaz9052 7 лет назад

    You are a magician :O!. Master Yoda, teach me how to use the force

  • @HarpreetSingh-cz2zh
    @HarpreetSingh-cz2zh 6 лет назад

    How did you get 0.5 and why did you divide it by 2? 11:05 of the video.

  • @ressalg
    @ressalg 7 лет назад

    What is the name of the editor that's being used in this video?

  • @busyrand
    @busyrand 6 лет назад

    This was super advanced and impressive! I was blown away by the depth of what you demonstrated, especially the logic of each piece of code. Thank you for sharing this. Subscribed....

  • @masteryoda63
    @masteryoda63 7 лет назад

    Learned new things about SVG today, thank you!

  • @milleniummoses
    @milleniummoses 6 лет назад

    You unknowingly also taught me some advanced CSS. Thanks for the video.

  • @kakaIbrah
    @kakaIbrah 7 лет назад

    Nice video. Very didactic. Tks.

  • @_jikkujose
    @_jikkujose 7 лет назад

    Absolutely good presentation, content & production quality! Keep up the great work!

  • @jurgentreep
    @jurgentreep 7 лет назад

    Saved this for later, looks promising!

  • @kramviteam552
    @kramviteam552 5 лет назад

    what font do you use?...

    • @MichaelGauciMT
      @MichaelGauciMT 4 года назад

      The codepen uses Avenir Next and Arial.

  • @ethanarrowood7454
    @ethanarrowood7454 7 лет назад

    Mind=Blown thank you so much for this.

  • @onlyafriend
    @onlyafriend 7 лет назад

    SVG can be Standalone File with reactjs component

  • @filemot25
    @filemot25 7 лет назад

    This is some of the cleanest and simplest code I've seen in a good while.

  • @swtrials2911
    @swtrials2911 5 лет назад

    I am just seeing this for the first time. You are blowing my mind.

  • @ositaka
    @ositaka 6 лет назад

    Very nice! thank you

  • @BEPPEJHA
    @BEPPEJHA 4 года назад

    In the meantime, me trying to center things in a responsive way on css

  • @FlaxeMusic
    @FlaxeMusic 5 лет назад

    This is exceptionally well presented on all fronts, well done.

  • @NickyKeyse
    @NickyKeyse 6 лет назад

    I'm just starting to look at svg and I'm so glad I found this video, thank you very much.

  • @luckylukeskywalker
    @luckylukeskywalker Год назад

    This is the typical youtube channel you don't want to have stopped

  • @249-a-b-n
    @249-a-b-n 7 лет назад

    Thanks for the very informative video :D

  • @rugia813
    @rugia813 6 лет назад

    This is really helpful, thank you!

  • @dukaxavier
    @dukaxavier 7 лет назад

    Wow dude, amazing!
    What is the name of the editor that's being used in this video?

    • @FrontEndCenter
      @FrontEndCenter  7 лет назад

      It's Webstorm. I've been using it for years and love it. I've also heard good things about VS Code, it might be a bit easier to get started with.

  • @orenmizr
    @orenmizr 7 лет назад

    concise & clear points. thanks

  • @flavourfulski
    @flavourfulski 4 года назад

    This tutorial is absolutely amazing, thanks!

  • @DisfigurmentOfUs
    @DisfigurmentOfUs 6 лет назад

    Great video, thanks!

  • @thiswiedel
    @thiswiedel 7 лет назад

    This is an amazing tutorial, thank you so much.

  • @tompazourek
    @tompazourek 7 лет назад

    There's also in SVG with xlink:href attribute. That can be used to have a standalone file while using the "inline" SVG mode. Any opinions on that, Glen?

    • @FrontEndCenter
      @FrontEndCenter  7 лет назад +1

      It's actually covered in the sequel to this video! (which is a subscriber-only episode I'm afraid) But the short version is this - the CSS rules that are possible with "true" inline SVG don't quite work the same when using . You can achieve _most_ of the same effects but IMO it's nowhere near as easy to work with. Here's a good resource: css-tricks.com/svg-use-with-external-reference-take-2/

    • @tompazourek
      @tompazourek 7 лет назад

      Cool, I'll have to check your subscription. I wasn't aware of those drawbacks, I thought the only issue was browser support.

  • @ShrinivasKattimani66
    @ShrinivasKattimani66 6 лет назад

    In love with SVG. Will start using using it.

  • @technicallygeckley14
    @technicallygeckley14 5 лет назад

    This is brilliant. Thank you so much.