Use this instead of :focus (most of the time)

  Рет қаралды 57,927

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 96
@r3pwn-dev
@r3pwn-dev 3 жыл бұрын
"Fun" fact about safari vs any other browser: buttons don't gain focus when clicked. Apple resolved it as "wontfix" because it's technically not required as a part of the HTML spec for buttons, yet conflicts with how every other major browser works 🙃
@dave6012
@dave6012 3 жыл бұрын
Get it together, apple! They also mess with 3d transforms too!
@MarvinT23
@MarvinT23 3 жыл бұрын
Lol thanks so much for the explanation, I just noticed this and was like wtf 😅
@HenrikBgelundLavstsen
@HenrikBgelundLavstsen 3 жыл бұрын
I find now a days safari is the new IE. always running into issues on safari for iOS or OSx or whatever they call it. (not a mac user)
@MrSkinkarde
@MrSkinkarde 3 жыл бұрын
@@HenrikBgelundLavstsen safari is the best browser.
@TesterAnimal1
@TesterAnimal1 2 жыл бұрын
@@MrSkinkarde really not
@n3cro2012
@n3cro2012 3 жыл бұрын
Yes, yes, yes. Been pulling my hair out due to this focus annoyance. Thanks for the tip.
@Antimated
@Antimated 3 жыл бұрын
I'm sure safari doesn't support it... Safari is the new IE 😅 EDIT: Yep it's safari lmao
@lucsoft
@lucsoft 3 жыл бұрын
Most of the Safari problems are not from the Safari devs. It’s more a problem of bigger up. So I kinda feel sad for the devs to call it internet explorer.
@VGVindaloo
@VGVindaloo 3 жыл бұрын
Of course it is. Seriously, I was so happy when MS finally started making browsers that mostly comply to standards, so you didn't have to add an IE fix to every fucking page, and then Apple steps in and fucks it all up again. Hello again shitty browser fixes.
@viriv
@viriv 3 жыл бұрын
@@VGVindaloo ive had to make little fixes for firefox from time to time as well. mobile browser viewport is also pretty terrible if you need content fixed on the bottom
@JaySee5
@JaySee5 3 жыл бұрын
Forever waiting for the FTC to start an anti-trust against Apple for Safari monopoly on iOS.
@covovker
@covovker 3 жыл бұрын
Not like new, safari was pain in the ass back in 2007 when I got my first web dev job. Sure, IE was a bigger problem at that point in the past, while safari is consistent in being a pain in the ass for all those years.
@JayCeeGee
@JayCeeGee 3 жыл бұрын
Cool. If I remember correctly, I've tried to achieve something similar with :not(:active):focus , :not(:hover):focus
@thiagosilvaloopes
@thiagosilvaloopes 2 жыл бұрын
Man, Kevin, you are really such an inspiration for me! Thank you so much for really all the content in your channel, so amazing and stunning the amount of great videos, energy, teaching and overall quality of your videos and persona!!
@aggelos_kilitis5405
@aggelos_kilitis5405 3 жыл бұрын
Omg i was looking for that for soooo long. You dont know how helpful this is!
@bernardus3289
@bernardus3289 3 жыл бұрын
"Look at that I broke code pen" I laughed at that and I don't know why.
@nathanmckean2348
@nathanmckean2348 2 жыл бұрын
UPDATE: focus-visible is supported in Safari for Safari 15.4 (March 14, 2022)
@magnustips
@magnustips 3 жыл бұрын
Great video Great teaching Great energy
@dave6012
@dave6012 3 жыл бұрын
This! Thank you, I was just dealing with this issue and was racking my brain how to fix it 🙌
@skilled-person
@skilled-person 3 жыл бұрын
Hi Kevin 😃 you never seize to amaze me. outline follow border radius, that's another layer of styling
@mverma7845
@mverma7845 3 жыл бұрын
looks like your feeling better Kevin, also my part of the internet is not a little bit awesome but it's HUGELY awesome cause of your videos.
@spencersedano
@spencersedano 3 жыл бұрын
Bro, there are so many things you can do in CSS that suprises me. I'd better keep learning JavaScript as well haha.
@itsviney
@itsviney 3 жыл бұрын
An aside in the video but I'd no idea that outline now honours border radius! That's great news... mostly. The big exception (of course) being Safari. Does anyone know if it's possible to check for support for outline radius using @supports? The problem I'm seeing is that because Safari *does* support 'outline' and 'border-radius' independently, I can't really check for support.
@arthurhtbk6596
@arthurhtbk6596 2 жыл бұрын
Thanks man, this video is a true gem!
@dawid2137pl
@dawid2137pl 3 жыл бұрын
Wouldn't it be better to use `@supports not selector(:focus-visible)` and apply inside of it styles for ":focus" selector than overwriting them inside `@supports selector(:focus-visible)`?
@jamestreble178
@jamestreble178 3 жыл бұрын
Another great content from the CSS Master 🙌🔥
@GigMyRig
@GigMyRig 3 жыл бұрын
Honestly, I had to pause the video as I laughed so hard at your shout out for IE 🤣
@inklingboi8431
@inklingboi8431 3 жыл бұрын
My guess is that safari doesn't support it edit: and as always nice video! I had the exact same problem in one of my websites and was able to fix it thanks to this
@mayukhbari
@mayukhbari 3 жыл бұрын
Could you please send me the link of full tutorial on flex. I use flex extensively and still think of lacking many knowledge.
@kromatic469
@kromatic469 3 жыл бұрын
A new css magic to add to my web project
@MartiZenith
@MartiZenith 2 жыл бұрын
Somehow, I needed to set .btn:focus { transform: none } as first rule in the @supports selector() to override the previous .btn:focus rule above it. Otherwise, when I click on a button the same problem comes back where the button stays upscaled even when moving the mouse away from the button.
@abhim6380
@abhim6380 3 жыл бұрын
So focus visible only works for keyboard focus?
@ליאורגולן-ה5ב
@ליאורגולן-ה5ב 2 жыл бұрын
you the man!
@ChanyArpin
@ChanyArpin 3 жыл бұрын
Could we not do it the other way around? .btn:hover, .btn:focus-visible { transform: scale(1.2); } @support not selector(:focus-visible) { .btn:focus { transform: scale(1.2); } }
@karl2673
@karl2673 3 жыл бұрын
In that case you'll have to add the :hover inside the @supports too, because the :focus-visible will break the whole selector in Safari.
@gopikab7393
@gopikab7393 2 жыл бұрын
Is there any class to style css on click other than focus
@johnaweiss
@johnaweiss Жыл бұрын
How is :focus-visible different from :hover?
@Mayranos
@Mayranos 3 жыл бұрын
You beautiful Man! Thank you!
@libbeytds
@libbeytds 2 жыл бұрын
Safari officially supports it both on desktop and mobile since 15.4
@AmirMo_Razmi
@AmirMo_Razmi 3 жыл бұрын
Hi , do you have any course or something to teach CSS ?
@PrinjuVaidyan
@PrinjuVaidyan 3 жыл бұрын
Safari doesn't have focus:visible :( I had to add a class using js for a component once
@ELStalky
@ELStalky 3 жыл бұрын
It's incorrect to say that the element is not receiving focus, it still is; as the pseudo-class states, it just is not necessarily visible.
@AbdicateDotNet
@AbdicateDotNet 3 жыл бұрын
Always great videos!!!
@reyzKhight
@reyzKhight 3 жыл бұрын
How is it possible
@pascalkonings1981
@pascalkonings1981 3 жыл бұрын
During the intro, is that your phone ringing? Or are you adding background music to your video's now?
@abhinabgogoi2000
@abhinabgogoi2000 3 жыл бұрын
Sir, do you prepare a pdf or a site for the css codes? Or if a ebook is available?
@KevinPowell
@KevinPowell 3 жыл бұрын
No. CSS tricks CSS almanac is pretty great if you want good written resources
@mverma7845
@mverma7845 3 жыл бұрын
at 1:00 I am guessing Safari, I would of said IE but MS doesn't even support IE LOL it could also be Edge.
@syedurwah
@syedurwah 2 жыл бұрын
what us the name that hes using as a live editor
@Rowan11088
@Rowan11088 3 жыл бұрын
*Shakes fist at sky* SAAFFFAAAAARRIIIII!!
@francescos7001
@francescos7001 3 жыл бұрын
ofc it’s safari
@adamzonnis980
@adamzonnis980 3 жыл бұрын
Hey, fellow Canadian, what city do you live in? I'm in Victoria!
@enriqueiglo2
@enriqueiglo2 3 жыл бұрын
Overriding and setting properties back to "normal" inside the querry is messy and a bad practice. You should instead use "@supports not" and and set :focus inside it.
@mverma7845
@mverma7845 3 жыл бұрын
at 5:00 you should of said it's safari you get what you get and you don't complain. LOL, you said something similar to that in a previous video.
@kosmar
@kosmar 3 жыл бұрын
would it be easier with _ supports not _?
@Stoney_Eagle
@Stoney_Eagle 3 жыл бұрын
Hey I left my custom video player on my codepen if you're curious what it has become so far. My name is the same as on here, it's on the main page. It's not perfect and done yet but I love it 😉
@tar_a
@tar_a 3 жыл бұрын
Opera browser?
@StephenMoreira
@StephenMoreira 3 жыл бұрын
My guess is Safari, let's see....
@T25de
@T25de 3 жыл бұрын
Same here
@shubhambhattacharjee1111
@shubhambhattacharjee1111 3 жыл бұрын
I like to use js and love it. But he make my love split almost 50 50 between js css.
@darshanpanchal7193
@darshanpanchal7193 3 жыл бұрын
Hello sir can you make once more navbar and this time you are make it small code of css I want to understand you are how to fit in mobile view and computer view bhot are working. Thank you sir if I'm written wrong so I'm realy sorry but I want saw you how its work in small code
@TheJazzNL
@TheJazzNL 3 жыл бұрын
Safari?
@ozgurg0
@ozgurg0 3 жыл бұрын
If a browser doesn't support a feature, this browser is probably Safari.
@benzflynn
@benzflynn 3 жыл бұрын
Not sure if this "problem" matters much. BTW, the automatic change of outline color is only in Chrome - it's not evident in Firefox. Opera's outline is almost rectangular as it doesn't border-radius to match the button. My own approach to outlines is to remove them 😅
@josvelema2362
@josvelema2362 3 жыл бұрын
For accessibility reasons the outline on buttons or other interaction objects are actually a good thing IMO
@KevinPowell
@KevinPowell 3 жыл бұрын
Don't remove them, restyle them if you don't like the defaults. Keyboard navigation is next to impossible without outlines!
@benzflynn
@benzflynn 3 жыл бұрын
@@KevinPowell But you've shown how to upscale selected elements with _.btn:focus { transform: scale(1.2); }._ That will show where you are on tab selection.
@KevinPowell
@KevinPowell 3 жыл бұрын
@@benzflynn oh, yeah! That's fine then. I just mean don't remove the outline and not replace it with something else, sorry for the confusion 😊
@GnotAGnoob
@GnotAGnoob 3 жыл бұрын
its always Safari, innit?
@Im-mustafa-saeed
@Im-mustafa-saeed 3 жыл бұрын
I can tell you with full chest without even watching the video that IE doesn’t support this 😂😂😂
@ThiagoAdomaitis
@ThiagoAdomaitis 3 жыл бұрын
I'll just keeep pretending Safari doesn't exist.
@salukim
@salukim 3 жыл бұрын
Has to be safari
@enriquesneffels3053
@enriquesneffels3053 3 жыл бұрын
it's such a pain we have to worry about those shitty browsers. If it weren't for all the other good things in web dev I would quit only for this crap.
@KevinPowell
@KevinPowell 3 жыл бұрын
While it's annoying, it's much better than it used to be, and it'll probably only continue getting better 😊
@dragonek_gnu_linux_pl
@dragonek_gnu_linux_pl 3 жыл бұрын
css is rly powerfull. Problem is browsers bcuse ppl don't updating them and we can have new options but it can't be visible everywhere. We still need to use old libaries and flexbox. Grid is still not supported everywhere.
@burhd5451
@burhd5451 3 жыл бұрын
Are you the who is making all these new CSS properties?. HAHAH
3 жыл бұрын
Saaaafariiii 🙄
@eduazy
@eduazy 3 жыл бұрын
Safari...
@dancewithakshara09
@dancewithakshara09 3 жыл бұрын
Safari or chrome but most probably safari.
@hiteshpaliwal8171
@hiteshpaliwal8171 3 жыл бұрын
Safari browser
@yajirushik2871
@yajirushik2871 3 жыл бұрын
I broke codepen, anyway xD
@reyzKhight
@reyzKhight 3 жыл бұрын
2nd comment
@MrSkinkarde
@MrSkinkarde 3 жыл бұрын
Learn to edit audio in your videos. Pro tip: USE DE-ESSER
@dankierson
@dankierson 3 жыл бұрын
You speak w@aaaaaaaaayyyyyyy too fast tbru the crucial parts. It's almost jabberwocky at times. Watch it yourself. LISTEN to it.
@abhim6380
@abhim6380 3 жыл бұрын
Yeah
Up your CSS game with these 3 pseudo-classes that nobody use
9:22
Kevin Powell
Рет қаралды 48 М.
My top 5 most popular front-end tips
22:07
Kevin Powell
Рет қаралды 57 М.
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 44 МЛН
Happy birthday to you by Secret Vlog
00:12
Secret Vlog
Рет қаралды 6 МЛН
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 116 МЛН
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН
The 6 most important CSS concepts for beginners
28:58
Kevin Powell
Рет қаралды 159 М.
The Most Important Skill You Never Learned
34:56
Web Dev Simplified
Рет қаралды 216 М.
A new approach to container and wrapper classes
25:27
Kevin Powell
Рет қаралды 266 М.
How you can simplify your CSS with :is()
9:20
Kevin Powell
Рет қаралды 336 М.
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 906 М.
Learn flexbox the easy way
34:04
Kevin Powell
Рет қаралды 722 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 412 М.
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 44 МЛН