Тёмный

CSS display none vs visibility hidden 

Steve Griffith - Prof3ssorSt3v3
Подписаться 102 тыс.
Просмотров 56 тыс.
50% 1

There are two CSS property declarations that can make an element disappear and sometimes it can be hard to know which one to use.
CODE GIST: gist.github.co...

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

 

29 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 49   
@Jtube0101Mega
@Jtube0101Mega Год назад
This is the best explanation about this topic I've seen. Thank you very much
@Maccelerate
@Maccelerate 6 лет назад
I'm going to start sharing your videos. Your clean and direct format for presenting the info is top notch. Your channel is going to explode man.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 6 лет назад
Thanks!
@mrx-qi8th
@mrx-qi8th 3 года назад
2:02 thats what visibility "HIDDEN "is doing . was a mistake there
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
The browsers have changed how they handle visibility hidden.
@medeirosbrendon
@medeirosbrendon 3 года назад
Couldn't expect a better and shorter explanation than that. Awesome job!
@eduardodaviola6272
@eduardodaviola6272 2 года назад
how i use Display + transition?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
Display cannot be used with a transition. Transitions are only for values like numbers that can have intermediate steps. The display property has only specific values. With JS you can listen for the transitionend event.
@1105-l9h
@1105-l9h 2 года назад
Thanks!
@arijitdas7526
@arijitdas7526 4 года назад
I don't think so. Even if you change the text color ur still able to select the "invisible" text😒😒
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
You can still select text of any colour, even transparent. I didn't get into all the effects for the different versions. I really was only talking about the visual effects of visibility vs display. codepen.io/mad-d/pen/YzwvOmX - this code pen shows color: transparent, visibility: hidden, opacity: 0, and display: none; The difference with EVENT handling is that display:none removes the element from the page, visibility hidden hides the element and disables event listeners, opacity and color: transparent hide the content while keeping the original space and still let events work.
@timonwa_loves_art
@timonwa_loves_art 3 года назад
Hi. Does it mean that you can't click on an element that is set to visibility hidden?
@vineethrao60
@vineethrao60 3 года назад
thanks man
@CarlosEduardo-nj9nz
@CarlosEduardo-nj9nz 2 года назад
Is this the method used to develop a responsive website?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
It can be part of a responsive page showing and hiding parts. Responsive has more to do with media queries and flexbox and grid displays.
@CarlosEduardo-nj9nz
@CarlosEduardo-nj9nz 2 года назад
@@SteveGriffith-Prof3ssorSt3v3 thank you :)
@inayatkhan2061
@inayatkhan2061 2 года назад
Thank you very much, good job good sir
@chhiwatssima4219
@chhiwatssima4219 5 лет назад
thank you
@vedinak7360
@vedinak7360 Год назад
Thank you for a great explanation!
@EngiLearn360
@EngiLearn360 2 года назад
thank you very much sir ❤
@IRONSILVER22
@IRONSILVER22 3 года назад
Very helpful and clearly explained, thank you!
@kllokoq
@kllokoq 4 года назад
It's very similar to what position: absolute and position:relative do to an element! Absolute removes it out of the flow of the document, while relative leaves a ghost!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Hadn't thought of it like that. Nice.
@GenerativeAI786
@GenerativeAI786 10 месяцев назад
Awesome job!
@jacksonvinicius299
@jacksonvinicius299 11 месяцев назад
very good my bro .
@sarfrazshah
@sarfrazshah 5 лет назад
awesome, thanks a lot for this info
@sriramkajjayam
@sriramkajjayam 2 года назад
Very nice 😍
@jbarx5435
@jbarx5435 2 года назад
Amazing explanation. Thank you. I am working on a memory game with images and this helped with some questions. Thanks!
@sisuup
@sisuup 3 года назад
question: if I only want text appears in 769px and 1025px, don't show in 481px. how could I write?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
Use media queries. I have a bunch of videos on those. You can search for them on my channel home page. Here is the first one - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-B6l6Wzmj4pA.html
@minhlekhoa7184
@minhlekhoa7184 3 года назад
Thank a lot you save my life, thank you very very much
@mateolorenzo4131
@mateolorenzo4131 4 года назад
So simple and clear. Thanks for sharing your knowledge bro! Excelent video.
@sunilpanwar2231
@sunilpanwar2231 2 года назад
Using a visibility value of hidden on an element will remove it from the accessibility tree. while opacity and font don't...and you can't actually click on element if visibility is set to hidden
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
Yes. It was changed. This was not the original intent of the two properties. But since the addition of the aria-hidden and confusion over the properties the browsers have opted to make visibility:hidden work the same way as display:none. Now, as you mentioned, opacity is the way to achieve what visibility used to do.
@alexvelazquez8487
@alexvelazquez8487 3 года назад
This is great! How do you make that paragraph hidden for 3 seconds and then make it automatically appear again? Can anyone help me with that?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
Use setTimeout to set the time and call a function to make it appear - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-0VVJSvlUgtg.html
@marg857
@marg857 3 года назад
It couldn't be explained better or more detailed. Good job
@webb-developer
@webb-developer 8 месяцев назад
@tomasj719
@tomasj719 6 лет назад
Thanks for making videos! Are you working with angular? It would be great if you could show some tricks with angular 6.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 6 лет назад
Hi Tomas, I am not working with Angular anymore since version 1.5. I am working with ReactJS and VueJS. I will be making videos about those this summer.
@suryakanth5370
@suryakanth5370 3 года назад
awesome explanation sir
@saikumar6062
@saikumar6062 5 лет назад
Simply awesome videos
@prasadsawant22
@prasadsawant22 4 года назад
Clearly explained
@shakib_04
@shakib_04 4 года назад
easy and simple
@robsen2543
@robsen2543 3 года назад
Can you still interact with display: none elements & bind events to them?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
You can still work with elements in javascript regardless of any css properties that they have. It is just the user interaction that is limited.
@robsen2543
@robsen2543 3 года назад
@@SteveGriffith-Prof3ssorSt3v3 I wanted also to know is there a way to see display: none elements in firefox or chrome devtools?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
They should still be in the HTML in the Elements tab.
@robsen2543
@robsen2543 3 года назад
@@SteveGriffith-Prof3ssorSt3v3 you're right. Overlooked them. Thank you very much :)
Далее
CSS Float and Clear Properties
10:48
Просмотров 33 тыс.
FATAL CHASE 😳 😳
00:19
Просмотров 1,5 млн
titan tvman's plan (skibidi toilet 77)
01:00
Просмотров 6 млн
БЕЛКА ЗВОНИТ ДРУГУ#cat
00:20
Просмотров 355 тыс.
Flexbox or grid - How to decide?
18:51
Просмотров 729 тыс.
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Просмотров 347 тыс.
opacity: 0 vs display: none vs visibility: hidden
4:04
Learn JavaScript DOM Traversal In 15 Minutes
14:44
Просмотров 225 тыс.
CSS in 5 minutes
8:16
Просмотров 147 тыс.