3 useful CSS hacks

  Рет қаралды 70,574

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 118
@turboballer
@turboballer 2 жыл бұрын
Man Kev, all of your videos are incredibly valuable but these videos lately - going over specific CSS topics that relate to easily dealing with real-world problems that developers face every day when building sites - are beyond valuable and I’m incredibly grateful.
@sylvio1687
@sylvio1687 2 жыл бұрын
Kevin please make a video building a website from scratch we'll see all things, like your thought process/building methods and other things. The video will be extremely popular as well
@c0d3r91
@c0d3r91 2 жыл бұрын
I AGREE
@Anth-ony
@Anth-ony 2 жыл бұрын
He's literally done that multiple times in the past. Check out all his older videos. He's made a responsive website from scratch, designed and built a brewery website, etc.
@quintenmantez6934
@quintenmantez6934 2 жыл бұрын
Me too! I agree! 😀
@nigelnix1
@nigelnix1 2 жыл бұрын
true, he's already done this multiple times.
@Pupu._
@Pupu._ 2 жыл бұрын
Agreeee!!!!🎉
@mdmizanurrahman3190
@mdmizanurrahman3190 2 жыл бұрын
The last one is life-saving. Can't tell how many times I ran into problem when had to work on other dev's project. Thank you very much, Kevin.
@deejaydev
@deejaydev 2 жыл бұрын
Thank you Keven - Becuse of you enjoy working with CSS
@xentric313
@xentric313 2 жыл бұрын
Everyone knows and loves you already, Kevin. No need for that introduction part anymore! :)
@JustHusband-rl8lv
@JustHusband-rl8lv 2 жыл бұрын
I think Kevin found a golden sweet spot with his new type of video’s!!! Fixing the “css problems / limitations” we face!!
@chimadivine7715
@chimadivine7715 2 жыл бұрын
Powerful hacks overall. The first hack reveals the potentials of using percentages as margin values. I recently ran into the first issue you addressed. I had to change the overall layout of the site I was building which was a bit depressing. But now I have one extra tool in my toolbox. Thanks so much, Kevin
@WePiphany
@WePiphany Жыл бұрын
I spy class="something | another-think" and now I have something else to learn. Always something new to learn, which is very refreshing considering how stale CSS used to be when held hostage by Internet Explorer not long ago.
@franco-cespi
@franco-cespi 2 жыл бұрын
As usual Kevin, your channel if full of all that content that I need on a daily basis to solve a problem at my job, keep up with the latest thing CSS related, or to keep improving my skills. Can’t thank you enough!!! I have been following you from my early days with web programming.
@wfl-junior
@wfl-junior 2 жыл бұрын
The full width hack is awesome, I never thought that being possible, I use to put containers manually on the children for those situations, now that hack is gonna come in hand for sure! Thank you!
@NiceChange
@NiceChange 2 жыл бұрын
absolutely loving your vids. making CSS a passion for me...thank you
@m3awna
@m3awna 2 жыл бұрын
For a long time, I thought Kevin's intro was: "Hello my friend and friends" and I was wondering why the heck he would say so... then today ... well, it's "front-end friends" 🤣🤣🤣🤣😂😂😂 silly me
@KevinPowell
@KevinPowell 2 жыл бұрын
Oh, you aren't the only one, don't feel bad 😂
@ThePulseProducer
@ThePulseProducer 2 жыл бұрын
Another full width trick I like doing is this. You make the main wrapping tag for the site content display grid and have 3 columns with 1fr for the left and right values and your container width for the middle value. Ex: body { grid-template-column: 1fr min(1196px, 90%) 1fr; } Then set all the initial children to use the second column. Ex: body > * { grid-column: 2; } and then have a full-width class that spans all the columns Ex: .full-width { grid-column: 1 / -1 } For responsive design this can all be set in a media query to trigger at a tablet/desktop breakpoint, or you can set a media query at a small tablet/mobile breakpoint that will also just make the initial children span all the columns so that there is no white space on the side.
@smartTechn0l0gy
@smartTechn0l0gy 2 жыл бұрын
Please keep it up and post more
@SatadruChique
@SatadruChique 2 жыл бұрын
Holy! The full width container breakout is gold!
@eioluseyi
@eioluseyi 2 жыл бұрын
This is awesome! I remember some situations I've been in where this could have come in handy, using WordPress. I had to take the longer route of going into the code to find where the html was placed. This would save my time in future. Thanks a lot!!
@Kaptain-T
@Kaptain-T 2 жыл бұрын
Hey, Kevin! I just wanted to say Thank you! I'm a huge fan. Started my Frontend journey a month ago and you've been of tremendous help.
@gamertag8721
@gamertag8721 2 жыл бұрын
what a coincidence you dropped in a video just as I was thinking of how to extend the background color for my one image that I had to refer to, and could not change.
@insaneviruss
@insaneviruss 2 жыл бұрын
Hey wow look at you dropping these nuggets as if they are nothing. This is so helpful! Thanks Kevin!
@ggsingla
@ggsingla 2 жыл бұрын
Literally blew my mind, these were some really clever tricks kinda forces you to think out of the box
@tigrafale4610
@tigrafale4610 2 жыл бұрын
literally, for a couple of them. hehe
@billychanclub8622
@billychanclub8622 2 жыл бұрын
Oh I love hacks with box shadow, that last one is great!
@brianparchamento9349
@brianparchamento9349 2 жыл бұрын
Bravo! Thank u Guys & Ladies...I could NOT have This Quick Turnaround.
@Stoney_Eagle
@Stoney_Eagle 2 жыл бұрын
It's a challenge to shift layouts with css alone but definitely satisfying when you get it working without ever touching the markup.
@VasilyPavlik
@VasilyPavlik 2 жыл бұрын
The last case is absolutely insane and very useful. Thanks a lot!
@kylevandeusen
@kylevandeusen 2 жыл бұрын
Love these kinds of videos. As a WordPress fella (yes, we watch you too!), tips like this are super useful
@Lord_zeel
@Lord_zeel 2 жыл бұрын
I came up with a nearly good solution for the full width, as long as your main column is centered: margin-inline-start: calc(-50vw + 50%); margin-inline-end: calc(-50vw + 50%); This has the advantage over the shadow of working with background images, gradients, etc. The problem with this though, is that the scrollbar will cause a little overflow if the page is taller than the window. This doesn't appear to be an issue in Firefox, which seems to render the scrollbar over the content. You can compensate for the scrollbar by adding the width of the scrollbar to the calculation: margin-inline-start: calc(-50vw + 50% + 5px); margin-inline-end: calc(-50vw + 50% + 5px); That's half the width on each side. Unfortunately, to ensure you know the width of the scrollbar you need to use ::-webkit-scrollbar, which would mean some silly nonsense to make this work correctly in all browsers. Scrollbars... ugh.
@vm-dev
@vm-dev 2 жыл бұрын
That is actualy in some way the exact thing Kevin mentioned in video .. But, hard-coding scrollbar width in CSS will still cause trouble, because scrollbars could be different widths in different browsers .. You could use CSS variable that is set by JS on body, and then add it into you calculation .. Though it might still produce some "glitchy" behaviour, if page renders quicker with CSS than the CSS variable is set..
@christophadamek2555
@christophadamek2555 2 жыл бұрын
As long as we don't have logical transforms, I wouldn't use the logical margin together with transform. margin-inline start together with translateX would break for vertical writing mode.
@MrMarkRGray
@MrMarkRGray 2 жыл бұрын
Commenting because you are awesome 👌
@shaderone07
@shaderone07 2 жыл бұрын
Those are some killer Hacks! loved it 😍
@jcc5018
@jcc5018 2 жыл бұрын
Hey, So I know CSS is typically used for web projects, but I am wondering if you have ever considered it for print layouts. For example, downloadable content that could potentially be customized by the end user. In my case, planner templates. But other use cases could be tickets, or itineraries or potentially even book layouts. From what I've learned so far, I will need a print media set, but I havent gotten too far beyond that. I believe I can change classes or styles with a bit of JS like Alpine.JS or something, but havent got that far yet. But the biggest challenge I think I will face is creating a preview screen that shows a layout of a page. Similar to what the various coding playground sites would offer, but the container must not alter the layout, but simply be zoomable. (If I set a 5x 6 page layout, that layout needs to print at that size even if the viewport is bigger or smaller.) My thought process was to create a container that corresponds to a standard page width. from memory, I think that comes out to 816 by 1056 px And then use grid or something to create various containers. with set margins, and styling applied for my different formats. Then a simple save to PDF and print, and you've got yourself a template. I'd imaging that I would need to turn overflow scrolling off, but I'm not sure if CSS could create new pages (instead of columns) on the fly or if I'd need another coding solution for that. Any thoughts? perhaps you could use this as a new challenge video/ tutorial? Why should we spend money on something like InDesign when we know CSS?
@ararthepro3972
@ararthepro3972 2 жыл бұрын
The second full width is pretty useful if you want to keep the alignment of the page
@smohammadhn
@smohammadhn 2 жыл бұрын
back here watching this video again when i finally realized that forcing full-width sometimes can be a lifesaver, I knew I saw the trick somewhere
@حيدرنوريطالب
@حيدرنوريطالب 2 жыл бұрын
Thanks you MR.Kevin this video is very helpful😍
@NiceChange
@NiceChange 2 жыл бұрын
Love this. Thank you
@pf2174
@pf2174 2 жыл бұрын
I'm stunned very impressive thnx
@IorPerry
@IorPerry 2 жыл бұрын
for border-radius instead of 100vmax you can use 9in that mean 864px usually is enough
@alvaroprietovideos
@alvaroprietovideos 2 жыл бұрын
🎉🎊 First time ever YT picks the "front-end friend" right!!
@celflowers74
@celflowers74 2 жыл бұрын
Hi Kevin, I really enjoy your videos as its very intuitive and really very interesting. I'm working on Oracle ERP but watching your video's I fell in love with HTML/CSS/Javascript so I usually watch your video's several times and try practice during my free time. Now I was wondering if you have the time, can you make a video on extracting data from oracle database and load and update it in HTML/Javascript form/page and update/insert back to oracle table. Just a simple name, age, bday form and will try to get idea on how to do it and learn. Appreciate it very much.
@lonleybeer
@lonleybeer 2 жыл бұрын
Thanks for making CSS less frustrating, i have started coding for less than a year now and I discovered your channel 8 months ago, you really helped me improve my CSS skills! Also, what theme are you using in your VS Code?
@angelojimmy1
@angelojimmy1 2 жыл бұрын
One Dark Pro Theme probably
@dusanlukic6784
@dusanlukic6784 2 жыл бұрын
it's called atom one dark :)
@PlayWithNiz
@PlayWithNiz 2 жыл бұрын
It'd be cool to see the last solution working with a background image!
@adamsDevArt
@adamsDevArt Жыл бұрын
thanks! it helped a lot !
@craiggazimbi
@craiggazimbi 2 жыл бұрын
Amazing , thank you.I hope to be better at css from your content
@clevermissfox
@clevermissfox 11 ай бұрын
How are there no closing curly braces? 4:01
@Laura69
@Laura69 2 жыл бұрын
For the border-radius case, can't we just use em units to make it adapt to the font-size of the element?.
@KevinPowell
@KevinPowell 2 жыл бұрын
You could, this is just one of those `100vmax` and never even think about it things. 10em and never think about it would work just as well :)
@micron9921
@micron9921 2 жыл бұрын
Excellent keyboard sound, what model do you have, switches, review?
@_Greenflag_
@_Greenflag_ 2 жыл бұрын
Your advices about full width within a container are really VILAIN. Just use negative left & right margin.
@razanajan7271
@razanajan7271 2 жыл бұрын
Kevin please complete the beyond css course, i've been waiting since April and you haven't completed the course, you say it will be there on May but it hasn't been there till now
2 жыл бұрын
It would be nice to know how much the shadow hacks impact the performance (speed/memory). I have impression that they might be heavy. I also do not like css which basically requires comments in order to be understood... but that's just my personal opinion. Nice video as always.
@seize2581
@seize2581 2 жыл бұрын
For the 3rd one you can also use negative margins.
@mebamme
@mebamme 2 жыл бұрын
I never knew about vmax, this will definitely come in handy for something I'm working on!
@eioluseyi
@eioluseyi 2 жыл бұрын
I'm on this table too! I can't believe it existed and I was oblivious to it 😂
@somnathgolui2912
@somnathgolui2912 2 жыл бұрын
when using linear gradient in CSS should I use a background image or the background property
@Nurtylek
@Nurtylek 2 жыл бұрын
hi, did u remove ripple effect video?)
@avneet12284
@avneet12284 2 жыл бұрын
Can't I use display:contents for removing things out of their container?
@HuynhLuong227
@HuynhLuong227 2 жыл бұрын
wow,...many thanks
@sumitanand5187
@sumitanand5187 2 жыл бұрын
Can anyone let me know if there is any way to put position:absolute element outside it's relative scrollable parent element...?
@TrueSQN
@TrueSQN 2 жыл бұрын
What does vertical bar "|" between classes in html? like in your code at 36line
@agent-33
@agent-33 2 жыл бұрын
Nothing. It's just a visual separator to make it more readable when you have many classes.
@animeclub1500
@animeclub1500 2 жыл бұрын
Awesome 👌 That gonna help alot . Thanks Css king 🤴 . Can you please make a tutorial of how to full control on classes within a container of background image cover, because it get really kind of messy 😅 when it comes to positioning other elements inside a background image.
@KevinPowell
@KevinPowell 2 жыл бұрын
I have a video that goes pretty in-depth on background images that might help: kzbin.info/www/bejne/aYXCe6xneNZ7b80 . If it's a background image, it should be decorational though...
@faycetoofayce7721
@faycetoofayce7721 2 жыл бұрын
Hi Kevin, please how do you get the result in real time in the browser with vscode ? Big Thank for all from France.
@nicothefreelancer
@nicothefreelancer 2 жыл бұрын
please do a tuts how to make a child div bleed fullwidth from a contained parent (section). example I have image-content layout and I want the image to bleed or touch the screen corners but the content stays contained and aligned based on parent(section) width. hope this make sense.
@jornzander1285
@jornzander1285 2 жыл бұрын
Cool!
@thedacian123
@thedacian123 2 жыл бұрын
Hello.Whici is the catch with | between classes,as far as i ikow this is not a valid html /css syntax.Thanks
@KevinPowell
@KevinPowell 2 жыл бұрын
It's just a visual separator, it doesn't do anything :)
@beautieshelp5973
@beautieshelp5973 2 жыл бұрын
Sir please reply How to reduce opacity of background image bcz the div containing reduces the items opacity also within that div.
@KevinPowell
@KevinPowell 2 жыл бұрын
Either a pseudo-element that overlaps the background image, or use an app to change the image itself.
@8koi139
@8koi139 2 жыл бұрын
"Creative" ways lmaooo My whole FE journey in a nutshell
@isaiahphilbert
@isaiahphilbert 2 жыл бұрын
Hi Sir!! Love the Tutorial and the hacks. Can you please make a video showing how to make a Working contact page that is linked with my Gmail using html, CSS and JavaScript. I'm really struggling with it Please help. God bless.
@jsart_pl
@jsart_pl 2 жыл бұрын
Brilliant video as always! I just have two little questions. Is this syntax: rgb(0 0 0 / 0.5) the same as: rgb(0, 0, 0, 0.5)? Seems new to me (it might be old tho, I'm not keeping up with new CSS standards). Does that work in all browsers?
@KevinPowell
@KevinPowell 2 жыл бұрын
That is the new syntax, and yup, works the same as what you put. Its supported everywhere except for IE.
@jsart_pl
@jsart_pl 2 жыл бұрын
@@KevinPowell Ah, cool! Thank you for your replay :)
@smashICE1
@smashICE1 2 жыл бұрын
Problem is also that Sass compilers do throw a failure when using this syntax :(
@pawpaaj
@pawpaaj 2 жыл бұрын
@@smashICE1 Which compiler are you using? If it's the VSCode plugin my guess is that it's not up to date and/or isn't maintained anymore. I'm using npm sass 1.49.8 (which btw is 4 months old at the time I post this message) and it's compiling correctly for me.
@geforcesong
@geforcesong 2 жыл бұрын
awesome
@beinyourguard
@beinyourguard 2 жыл бұрын
what does the vertical bar in the class attribute (line 36 in 4:32) mean?
@KevinPowell
@KevinPowell 2 жыл бұрын
It's just a visual separation, it doesn't do anything :)
@beinyourguard
@beinyourguard 2 жыл бұрын
@@KevinPowell thank you! great video as always
@drementer9
@drementer9 2 жыл бұрын
🔥
@RobertMcGovernTarasis
@RobertMcGovernTarasis 2 жыл бұрын
Have a lovely weekend
@amjadshadid90
@amjadshadid90 2 жыл бұрын
thanks
@sly218
@sly218 2 жыл бұрын
Hello Kevin, great video as always! Btw, how long of practice would it take to be a front end developer and actually be hired?
@KevinPowell
@KevinPowell 2 жыл бұрын
That's such a hard question to answer! Depends on how fast they pick things up, the job market where they live, and on a lot of luck, lol. I wish I had a good answer.
@sly218
@sly218 2 жыл бұрын
@@KevinPowell Alright, sorry for the complicated question hehe. Though, thank you for taking the time to answer my question! :)
@hcjlimits3321
@hcjlimits3321 2 жыл бұрын
It's depend on how you love what you do
@okopyl
@okopyl 2 жыл бұрын
Regarding the limitations of the last method - clip path support is terrible
@ahsath
@ahsath 2 жыл бұрын
Both last tips are a bit overkill, I'm doing a website and had this same use case, you can just create a container that center your content and place it inside your wrapper, footer > .container and that is it, obviously if you have control of your HTML and CSS
@KevinPowell
@KevinPowell 2 жыл бұрын
The issue is, we don't always have control over the HTML, otherwise, yes, I wouldn't do this 🙂
@okopyl
@okopyl 2 жыл бұрын
Break out of a container - negative margin
@blazi_0
@blazi_0 2 жыл бұрын
I miss css so much 😔
@ghostandgoblins
@ghostandgoblins 2 жыл бұрын
I just spoke to CSS, and they said they miss you too as tears were cascading down their cheeks.
@quintenmantez6934
@quintenmantez6934 2 жыл бұрын
👍
@somnathgolui2912
@somnathgolui2912 2 жыл бұрын
do you write blogs because like to read blogs than watching videos
@KevinPowell
@KevinPowell 2 жыл бұрын
not at the moment, but I do have plans to start
@somnathgolui2912
@somnathgolui2912 2 жыл бұрын
​@@KevinPowell please do so i always prefer written tutorials like blogs or something because while coding for 12 hour per day every seconds matters but if the thing is that complex then need to watch video explanations
@eeew2691
@eeew2691 2 жыл бұрын
@@somnathgolui2912 Dude you wrote it like he should comply your demands 😅😅. Man is busy creating amazing content
@somnathgolui2912
@somnathgolui2912 2 жыл бұрын
@@eeew2691 Yes obviously he is a very busy man how also helping us to learn CSS for free so that we can prosper in our careers, he is contributing in the community and i truly grateful that we have teacher like him. Usuly content creater ask to give feedback that's why I just commented it whithout think deep If it's hurt or any of you find my comment rude then all I can said is "sorry for my words"
@c__beck
@c__beck 2 жыл бұрын
::SMASHES THAT LIKE BUTTON::
@flowerofash4439
@flowerofash4439 2 жыл бұрын
custom dialog? just use alert() like a man
@alexanderrydberg6118
@alexanderrydberg6118 2 жыл бұрын
early
@lycan2494
@lycan2494 2 жыл бұрын
Hi Kevin. I'm a HUGE FAN! I just sent you a message on twitter. Could you please take a look?
@hikari1690
@hikari1690 2 жыл бұрын
Yay! I knew the first 2 and understood what's going on in the other 2 even before the explanation! Can I finally graduate from being a junior dev? 🥲
4 ways to deal with overflowing text
4:35
Kevin Powell
Рет қаралды 80 М.
5 super useful CSS properties that don't get enough attention
16:23
Kevin Powell
Рет қаралды 148 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,2 МЛН
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 23 МЛН
2 better alternatives to overflow: hidden
11:04
Kevin Powell
Рет қаралды 161 М.
Can I clone this rotating, gradient, inner glow effect?
23:05
Kevin Powell
Рет қаралды 18 М.
10 Tailwind Classes I Wish I Knew Earlier
13:31
Web Dev Simplified
Рет қаралды 196 М.
CoPilot Review: My Thoughts After 6 Months
9:45
ThePrimeagen
Рет қаралды 556 М.
5 simple tips to making responsive layouts the easy way
15:54
Kevin Powell
Рет қаралды 779 М.
The new CSS pseudo-classes explained - :is() :where() :has()
13:50
Kevin Powell
Рет қаралды 141 М.
Container Queries are going to change how we make layouts
24:24
Kevin Powell
Рет қаралды 177 М.
:has() opens up new possibilities with CSS
14:30
Kevin Powell
Рет қаралды 288 М.
My top 5 most popular front-end tips
22:07
Kevin Powell
Рет қаралды 64 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 982 М.