One of the most common CSS issues people run into

One of the most common CSS issues people run into

Kevin Powell

1 год назад

66,565 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@gdm_music
@gdm_music - 21.03.2024 15:10

this is not usefull att al, i was soo sure cliking this video, that kevin is gonna blow my mind with an out of the world CSS Trick as usual, but what the hell he just did my removing percentage value in place of a absolute value. what if i really need a percentage like i really need it to be half the size of the parent no matter if parent grows or not

Ответить
@metaxtatic
@metaxtatic - 19.02.2024 11:57

has anyone ever encountered an error (when using framework like next js or sveltekit) that triggers the browser crash "Aw snap! status access violation" ? the error happened right after hovering over certain element that has height set to 100%, the moment i got rid of the height:100, it didn't trigger the error? guys please help, it's been 4 months and i literally have no idea what went wrong, i never encountered this kind of error when using react or vanilla js,

Ответить
@sedmidivka
@sedmidivka - 30.01.2024 17:55

I hate css so much and I'm trying to learn how to live with it through your videos :D this is such pain I hate the person who created this mess......... please someone help

Ответить
@EdygarOliveira
@EdygarOliveira - 29.11.2023 21:31

A CSS custom property may be helpful to both maintain the code readable and avoid seemly arbitrary values:

.parent {
—height: 75vh;
min-heigh: var(—height);
}

.child {
height: calc(var(—height) * 0.5);
}

Ответить
@navi2710
@navi2710 - 20.11.2023 09:12

This seems more like an issue caused by the technical implementation of css. In a situation like this the interpretation of min-height should return a static value which the height% could work off.

I understand that is not how it works right now and that is entirely an issue created by developers because of the way the developers programmed browser engines.

Ответить
@davidfitcher2953
@davidfitcher2953 - 13.11.2023 21:59

You are REEEEEALLY the king of CSS

Ответить
@rcarias78
@rcarias78 - 09.11.2023 07:59

Hey Kevin. Any tips and tricks on how to make an IFRAME height full height?

Ответить
@_surreal99
@_surreal99 - 07.11.2023 23:26

css is the one thing that brings my work to a screeching halt every single time.

Ответить
@wasimpatel2618
@wasimpatel2618 - 07.11.2023 11:52

kevin, where can i ask questions to you ? i mean sometimes after trying everthing i still unable to figure out somethings , even googling does not help , i dont have any teacher and any friend who can teach me , so what to do?

Ответить
@codewithdave
@codewithdave - 06.11.2023 19:18

Brilliant explanation Kevin.

Ответить
@kenelsom
@kenelsom - 06.11.2023 15:05

Your excellent videos usually deal with a single page but my problem is that I have pages with nested iframes and am struggling to set their height. Also, I usually access these pages from a local directory with no internet connection. If I use java code that accesses the document.documentElement.scrollHeight property then I get: SecurityError: Permission denied to access property "document" on cross-origin object. This is crazy as the file being accessed is in the same local directory as the parent page. I end up having to set the heights manually with something like 7000px which is necessary to stop a second scroll bar on the longer pages but this does not look good on shorter pages. I want to access the “inner” pages without scroll bars so they just flow with the parent but how do you set the height automatically? Thanks for your great work!

Ответить
@allsunday1485
@allsunday1485 - 03.11.2023 17:52

This would be easier to visualize if you didn't leave the darkblue commented out

Ответить
@iamifechi
@iamifechi - 02.11.2023 20:39

How about giving the h1 a min-height of 50%

Ответить
@alexm9104
@alexm9104 - 02.11.2023 12:59

So we can use:

body {
--height: 75vh;
min-height: var(--height);
}

h1 {
min-height: calc(var(--height)/2);
}

And this "height: calc(var(--height)/2)" logically should be equal to 50% of the body height, but without custom properties it's not for some reason...

Ответить
@esh6190
@esh6190 - 02.11.2023 00:37

Great Videos Kevin.. Thanks for the clarification.. I mostly work with maps mostly leaflet where i have to specify a height say 90 or 100vh.. If i use a min-height it doesn’t work. Its weird. Would be great if you can do a video on maps and how to use css on any map library like leaflet( which is open source) 😜

Ответить
@sorcerer2608
@sorcerer2608 - 01.11.2023 20:53

Hey Kevin I'm coming from your css demystified course it's so much hilarious that you didn't know the plural of flex basis is basises or basies 🤣🤣

Ответить
@carinlynchin8255
@carinlynchin8255 - 01.11.2023 17:26

Actually I'm pretty sure all you had to do was set height = 0px, the min would then take effect and the child css would work.

Ответить
@SamihaFerdous
@SamihaFerdous - 01.11.2023 16:08

it was totally sh*it buddy.. worst ..

Ответить
@hikari1690
@hikari1690 - 01.11.2023 11:59

omg, I remember this early in my training... block elements always made me feel like a block head

Ответить
@tmbarral664
@tmbarral664 - 01.11.2023 10:33

Oh ! The loop that lead to a crash ! Brilliant! That’s obvious ! But I didn’t see that. Muchos kudos for the enlightenment Kev ;)

Ответить
@mohitashliya8750
@mohitashliya8750 - 01.11.2023 08:32

This was the problem for me for a long time thanks a lot.

Ответить
@Mempler
@Mempler - 01.11.2023 04:46

Web dev is the only desktop application development that is still actively developed, truly cross-platform and doesnt get killed every 2 weeks (looks at Microsoft)

Ответить
@roymosby8511
@roymosby8511 - 01.11.2023 03:05

Are there any CSS linters or tools that can spot these sorts of issues?

Ответить
@bmehder
@bmehder - 01.11.2023 01:38

Thanks for the video. It made me think of another css height related question. What's the deal with setting the html and body elements to 100% that I see as a part of a lot of default css stylesheets? I have never used that, and I am wondering if I should be.

Ответить
@RedstoneHair
@RedstoneHair - 31.10.2023 22:33

I had that issue yesterday

Ответить
@likandokayombo
@likandokayombo - 31.10.2023 22:31

You make CSS simple

Ответить
@manojht8036
@manojht8036 - 31.10.2023 21:13

Is calc(inherit/2) possible ?

Ответить
@ChamplooMusashi
@ChamplooMusashi - 31.10.2023 20:55

Are there tools for static analysis of a page at runtime for situations like you described where styles are implicitly ignored? Like generating a report of classes that tried to apply some style but it was invalid and the nodes responsible for causing it?

Ответить
@i_am_ergo
@i_am_ergo - 31.10.2023 20:31

Gotta love browser logic. It saves us (and our users) from ourselves.

Ответить
@lastspoil5547
@lastspoil5547 - 31.10.2023 20:16

Do we have to be good at HTML and CSS if we can use Anima to turn figma designs to code with magic?

Ответить
@SashenMe
@SashenMe - 31.10.2023 20:13

And another issue with 100vh is it's not working on mobile browsers. 🥲

Ответить
@p__wing
@p__wing - 31.10.2023 20:08

Wait did you switch to Chrome?!

Ответить
@PicSta
@PicSta - 31.10.2023 20:04

The solution is not to make it this way. Use Grid or Flex and you are good to go. IMO this is the wrong approach. I get why beginner think that way.

Ответить
@DennisHaney
@DennisHaney - 31.10.2023 19:38

If only the browser actually gave a debug warning about this, so you can learn it during development

Ответить
@janmacek5672
@janmacek5672 - 31.10.2023 19:29

On parent, do {
Height: 1px;
Min-height: 75vh; }

Then child works with percentage from bigger min-height. Dont know mechanics and browser support 🤷

Ответить
@adamos.webdev
@adamos.webdev - 31.10.2023 19:28

CSS is so powerful 💪💪

Ответить
@elearning2432
@elearning2432 - 31.10.2023 19:08

Make a demo on IFRAME responsive css. Like to embed a webpage

Ответить
@marcindomanski5654
@marcindomanski5654 - 31.10.2023 19:03

min-height + height works with position: absolute for children. Sometimes this is useful

Ответить
@Akimb321
@Akimb321 - 31.10.2023 17:39

Hey, Kevin. Would be interesting if you did a video on replaced elements. Both MDN and the CSS spec is a bit abstract on the topic, but maybe you could share your insights

Ответить
@eqprog
@eqprog - 31.10.2023 17:32

Maybe CSS should update their standards to basically allow minimum height to affect % height so that way the browser developers will eventually include it. It seems like a pretty simple algorithm to me. If no height is defined and min height is defined, then height = min height OR current height. Then the child height % would have a value to work off of. There should be ways to do this without an endless loop occurring.

I don't know if thats the best solution... But this problem still is one of the least intuitive aspects of CSS and should be 'solved'. There are plenty of other css values that can get calculated real-time so why can't this? Boo

Ответить
@tamasstadler6413
@tamasstadler6413 - 31.10.2023 17:31

Question:
Would it work, if the parent element (with the min-height: 75vh) would also have a set height (height: 1px;)?
Or is it just plain stupid? 😅

Ответить
@KB04
@KB04 - 31.10.2023 17:21

Hey kevin, do you think you could a video about intentionally overflowing things?

Ответить
@HeyJes
@HeyJes - 31.10.2023 17:17

Great video Kevin! I love CSS but height is definitely one of the things that can drive me insane, haha.

Ответить
@VeitLehmann
@VeitLehmann - 31.10.2023 17:14

Thanks a lot for education like this! I'm constantly removing width: 100% or 100vw and defined heights from our projects.

Ответить
@thecodecatalyst
@thecodecatalyst - 31.10.2023 17:14

Thanks for the great explanation. For me it makes a lot of sense thinking about height being an static measure and min-height a promised so you can't calculate the percentage of a number you don't know up-front.

Ответить
@gE0013
@gE0013 - 31.10.2023 17:12

I just realised that you are saying "Hello my front-end friends" and not "Hello my friend and friends" XD

Ответить
@hellothere8547
@hellothere8547 - 31.10.2023 17:04

One of the biggest problems I always face when building for mobile is the menu height always tries to “catch up” to the device screen height. Especially when I build menu screens with 100% height, but I’ve also tried min height 100%.

That said, if I scroll up or down the height is always re-calculated causing constant unwanted shifting of content on the menu. And I can’t solve this problem.

Ответить