Тёмный

Responsive Gauge (CSS-Only) - HTML, CSS & JavaScript Tutorial 

dcode
Подписаться 132 тыс.
Просмотров 46 тыс.
50% 1

Link to source code:
codepen.io/dcode-software/pen...
In today's video I'll be showing you how to create a responsive gauge using pure CSS - the only JavaScript required is to update the value, if you choose to do so!
This may also be known as a "speedometer".
Support me on Patreon:
/ dcode - with enough funding I plan to develop a website of some sort with a new developer experience!
Follow me on Twitter @dcodeyt!
If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
#dcode #css #webdev

Опубликовано:

 

5 апр 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 70   
@gabriellacroix3027
@gabriellacroix3027 10 месяцев назад
One of the clearest walkthroughs I've ever watched on YT. Well done!
@ias115
@ias115 2 года назад
What a superb tutorial: clear, precise, not just the 'how' but also the 'why'. Thankyou!
@RobertWildling
@RobertWildling 4 года назад
2 values for one border radius? Total news flash to me! fantastic! Very nice idea, very tutorial, very nice presented! I like it a lot!
@diegoaguilar2055
@diegoaguilar2055 3 года назад
Amazing, just keep doing this tutorials, are for sure very helpful, love it
@chamidrakumari2195
@chamidrakumari2195 7 месяцев назад
The best it can ever be explained. Thank you so much sir. Learnt CSS clearly today. keep up the good work.
@virenkamra5050
@virenkamra5050 Год назад
Keep up the good work , clearly explained , clear thought process provided 🔥
@ikkentonda
@ikkentonda 2 года назад
Outstanding! Incredibly well explained. CSS is often a "write-only language" (like perl was once accused of being). It's often very hard to understand what a large chunk of CSS is actually doing. On the other hand, it's purely visual programming. That's what makes these sorts of high-quality, step-by-step visual explanations so incredibly satisfying. Thank you!
@MrMarcoAlvarado
@MrMarcoAlvarado 2 года назад
Ok, according what you are saying you understand what CSS is doing here, right. (due to the high-quality step-by-step tutorial) So according to that you could easily e.g. add a measuring scale on top of the gauge, right!? How would you do that?
@ikkentonda
@ikkentonda 2 года назад
@@MrMarcoAlvarado I’m unsure if you’re serious, but if so I’d probably resort to svg rather than pure CSS for a graduated scale.
@MrMarcoAlvarado
@MrMarcoAlvarado 2 года назад
@@ikkentonda An svg as a backlayer of the gauge, sounds complicated? - The author starts with .gauge-body { width: 100%; height: 0; padding-bottom: 50%; } He claims that he found this in the internet and it's kind of "hacky". So how can I add something to this? As long as don't understand how this works I can't add anything and with this it is non-reusable code for me.
@tahasoft1
@tahasoft1 4 года назад
Awesome! 👌 you can also use for semicircle: border-radius: $div-width $div-width 0 0;
@aporfirio
@aporfirio 5 месяцев назад
Good job guy !!!!!. Excelent, simple and it works perfectly
@sewingfashionhome6021
@sewingfashionhome6021 8 месяцев назад
Clearly Explained everything. Thankyou!!
@hardikcc
@hardikcc 3 года назад
Thanks, great work. Really helpful.
@blueprint7000
@blueprint7000 4 года назад
Nice Tutorial as always. Can you do a tutorial on how to make the material design cycle effect when clicking on Tabs?
@allanina
@allanina 2 года назад
thank you so much!!!!! I needed a chart like that for something at work and your video saved my ass!! thank you so much
@WaheedRafiq
@WaheedRafiq 3 года назад
Easy to follow tutorial, dyslexic friendly and professionally conducted best of all it totally free and you can access the code should you have made any mistake that what I call quality code sharing for passion and not profit well done Dcode and keep up the hard work
@dcode-software
@dcode-software 3 года назад
Awesome!! Thank you and you're welcome
@ehabgame
@ehabgame Год назад
@@dcode-software how can we controll it with an input range? and thank you for this good tutorial
@raspberrynode8802
@raspberrynode8802 Год назад
Exceptional Work
@muhammadluqman185
@muhammadluqman185 3 года назад
thank you so much....it helped me a lot
@atmaneakssas164
@atmaneakssas164 4 года назад
well done bro lovely #from morocco
@yukning2415
@yukning2415 Год назад
thanks for the tutorial
@romuloalves9349
@romuloalves9349 4 года назад
Ótimo vídeo parabéns 👍.
@TheMrJuoji
@TheMrJuoji 4 года назад
nice tutorial but why does gauge__cover horizontal placement has to be left :50%; transform: translateX(-50%); when left = 12.5%; does the exact same thing ?
@grainfrizz
@grainfrizz 4 года назад
Freaking amazing
@dcode-software
@dcode-software 4 года назад
Happy to hear you enjoyed it!
@noah_ishappy
@noah_ishappy 4 года назад
Oh man ! You have a 18.734th subscriber😂😂❤
@dcode-software
@dcode-software 4 года назад
Cheers mate!
@easylife5146
@easylife5146 Год назад
Good work bro🎉 can you do how to create a vertical gauge with values as a ruler!?
@Targonir
@Targonir 3 года назад
hey, any Idea on how I can add a pointer / numbers in the axis? thanks!
@inesines1745
@inesines1745 4 года назад
Thank you 😁
@dcode-software
@dcode-software 4 года назад
No problem 😁
@tormak
@tormak 3 года назад
my guage doesnt display any values when using the function
@sophiemary
@sophiemary 3 года назад
How can i write markings indicating the percentage around the gauge?
@jcbsamm258
@jcbsamm258 Год назад
I am having a problem with the gauge__cover class, it is positioning differently for me than it does in your demonstration, even when I copy the source code directly. Any help would be appreciated
@cheesehunt9678
@cheesehunt9678 2 года назад
How to allign the gauge to the center like the one you show as the preview?
@goosebumps1646
@goosebumps1646 Год назад
How to show 2 or more data inside a gauge like half donut chart? Can we add more than 1 fill sections in it?
@shivammahobiya536
@shivammahobiya536 4 года назад
well.done 😎
@Gitbizy
@Gitbizy 2 года назад
How do I set the position/value of the half circle by simply clicking on a location on the semi circle?
@mihirajwijesooriya4841
@mihirajwijesooriya4841 4 года назад
Awesome! 👌 super....
@dcode-software
@dcode-software 4 года назад
😁
@samitdigitalart
@samitdigitalart Год назад
Can you please demo another video by adding a needle. I have tried with turn but not working, i think deg is required for that. Please guide if possible
@DJ-pn9te
@DJ-pn9te 2 года назад
I tried putting this code inside a grid item within a grid and it did not position correctly. what would cause that?
@linhtran-fj9ue
@linhtran-fj9ue 2 года назад
How to make radius and show start and end value?
@normandcyr
@normandcyr 2 года назад
Very clear tutorial. Now I would like to have more than one gauge graph on a webpage. Is it feasible with your approach or am I limited to a single gauge in the page?
@DavoShed
@DavoShed 2 года назад
Did you figure out how to duplicate the gauge? I'm sure it can be done but I'm a bit confused which bits to rename and duplicate.
@normandcyr
@normandcyr 2 года назад
@@DavoShed No I haven't. I believe you'll need javascript.
@DavoShed
@DavoShed 2 года назад
@@normandcyr Thanks for replying I’ll post here again if I figure it out. I know you have probably moved on :)
@paulogoncalves1459
@paulogoncalves1459 2 года назад
@Davo’s Shed @Normand Cyr It depends on what framework you are working with. In my case i am using Angular(typescript) and i just created a component with this gauge, and i can call it on my html as many times as i want (using "ngFor" for example). If you don't want to use javascript or typescript, you need to repeat your code of the gauge, in your html.
@DavoShed
@DavoShed 2 года назад
@@paulogoncalves1459 I figured it out or worked around the problem :) I needed 4 gauges so I just created gauge1 gauge2 etc. Programming 101 tells me if I’m cutting and pasting 90% of the code I’m probably doing it wrong. But it was a quick fix and was still fairly tidy and readable. Thanks for your reply as it confirms what I thought.
@tamas-pamas
@tamas-pamas 4 года назад
when you call the setGaugeValue() function why do you have to pass in the element as a parameter? it's not been used in the function... thanks in advance
@dcode-software
@dcode-software 4 года назад
It is being used in the function, with the "gauge" parameter
@WhiteBoyMikey21
@WhiteBoyMikey21 2 года назад
nice
@mumar1197
@mumar1197 Год назад
how to decrease size of this guage?????????
@nanonorthlabs3375
@nanonorthlabs3375 3 года назад
Why didn't you just set the gauge__cover left to 12.5%, it would have centered it.
@jerodbradley4395
@jerodbradley4395 4 года назад
How would I update the gauge dynamically through an input box if a user inputs a number? I've tried everything I can think of
@pratikgohil7821
@pratikgohil7821 4 года назад
setGaugeValue(gaugeElement, inputvalue/100) (user has to input value between 0 and 100)
@jeremytiempo9639
@jeremytiempo9639 2 года назад
your code works on me .. im asking how to change max value from 100 % to 500% im newbie in html im sorry for that
@garrybogdanho
@garrybogdanho 4 года назад
haha im here again
@andrewshepin6659
@andrewshepin6659 3 года назад
YOU NEED TO BE FAMILIAR WITH CIRCULAR GAUGE THE SITUATION: We copied the questionnaire from other website. - On original website - When the person finished the questionnaire she/he will see her/his score on the circular gauge. - On our website - we have the copy of the questionnaire and the copy of the circular gouge BUT there is no link, no formula that shows the score after person finished the questionnaire. WE NEED: to develop connection between result of finished questionnaire and the showing on the Gauge. What you will have: the name of the original website and our website. YOU CAN FIND THE FORMULA ON ORIGINAL WEBSITE OR YOU CAN DEVELOP THE FORMULA The only requirement for the formula - that result on OUR website will be SIMILAR to the ORIGINAL website.
@dcode-software
@dcode-software 3 года назад
Maybe I'll do a video on circle gauges soon? Lol
@MaxProgramming
@MaxProgramming 4 года назад
I don't get your name because of your accent as I am from India. Can you write it out pls?
@dcode-software
@dcode-software 4 года назад
My name is Dom
@MaxProgramming
@MaxProgramming 4 года назад
@@dcode-software Great name, Document Object Model. Sorry if you are hurt
@dcode-software
@dcode-software 4 года назад
All good mate, I've had plenty of comments of people pointing out that my name is Dom and I'm doing videos on the DOM 😂
@MaxProgramming
@MaxProgramming 4 года назад
@@dcode-software Yeah. Because many people get hurt. But a really good name. I liked it
@MaxProgramming
@MaxProgramming 4 года назад
@Aboubakr Hollanda BTW, My real name is Usman
@rverm1000
@rverm1000 Год назад
gauge.querySelector('.gauge__fill').style.transform = 'rotate(${value/2}turn)'; gauge.querySelector('.gauge__cover').textContent='${Math.round(value * 100)}%'; i cant get this to work properly . math.round shows up as text
Далее
РЖАВАЯ МОЛОДОСТЬ. ДЕВЯТКА
33:56
Просмотров 613 тыс.
КАК Я ЖИВУ БЕЗ ДЕВУШКИ!
25:30
Просмотров 943 тыс.
МИЛОТА🥹
00:11
Просмотров 1,3 млн
Learn Flexbox CSS in 8 minutes
8:16
Просмотров 1,4 млн
ESP8266 Web Server using CSS and JavaScript
6:21
Просмотров 52 тыс.
Build Gauge With HTML, CSS & JavaScript
19:53
Просмотров 10 тыс.
РЖАВАЯ МОЛОДОСТЬ. ДЕВЯТКА
33:56
Просмотров 613 тыс.