The background values no one knows about

  Рет қаралды 42,416

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 131
@samwalker4438
@samwalker4438 8 ай бұрын
I thought Kevin was saying “hello my friend and friends” Front-End Friends makes so much more sense 😂
@dirkvandiepen1890
@dirkvandiepen1890 8 ай бұрын
I have been thinking that for 6+ months! Even knowing what Kevin actually means it still sounds more like "hello my friend-end friends"
@LennartKlein
@LennartKlein 8 ай бұрын
Hahaha thank you soo much for clearing this up
@_zer09_
@_zer09_ 8 ай бұрын
accidentally found out as well when I had CC on months ago 😅
@ivanbryukhov
@ivanbryukhov 8 ай бұрын
No way!!! I thought the same for years and never ever doubted it. Now it makes much more sense. My life would never be the same... Now it is so obvious! Why would he even say "friend and friends", right?
@marcorieser
@marcorieser 8 ай бұрын
Today I learned 😁
@DatDat59
@DatDat59 8 ай бұрын
Seeing repeat-x and repeat-y reminds me 2000s when we were using an image mapped to simulate shadows and radius around a block made of a table with 9 cells.
@gizmostudios
@gizmostudios 8 ай бұрын
Oh wow that takes me back :'D Draw a button in Photoshop, add gradient, drop shadow, 9 slices and painstakingly write all the code for one button to reproduce! How much easier life's become for a web designer these days, thank god!
@codclever
@codclever 8 ай бұрын
Very thankful to have an nice coding support for our CSS and frontend issues. Love your videos man!
@clevermissfox
@clevermissfox 8 ай бұрын
Love to learn about new obscure properties!! Background-repeat; space seems very valuable!
@TheRealMangoDev
@TheRealMangoDev 8 ай бұрын
thats bc it is
@kevinphandy2
@kevinphandy2 8 ай бұрын
I used this to add repeating side facing chevrons for a client. The designer had it as a leading element to various things. Used space to make it a responsive element changing the amount based on how much room there was.
@pdizzlin
@pdizzlin 8 ай бұрын
Lol…it’s funny the number of people that hear “friend and friends”. I always heard front-end friends myself! Funny how everyone’s brain hears different things l.
@gizmostudios
@gizmostudios 8 ай бұрын
Wait... it's not? Which one is it? I also hear Friend and Friends :'D
@brunopanizzi
@brunopanizzi 8 ай бұрын
6:10 Round is very useful for the hero section of a website that I'm making, the bg image is just a small 16 by 16 square repeating, and without round it always cropped off the last one because it's not the perfect size. Thanks for the tip, will be updating my site today!
@joll05
@joll05 8 ай бұрын
I hadn't seen round before this, and I also think it's kinda weird when it stretches the image, but I played around with it and I think I found a more practical way of using it. If you combine it with a different repeat value (for example 'background-repeat: round repeat;') then it will resize the image equally in both directions so that it fits either horizontally or vertically (depending on which one is 'round'). This means that the image won't be cropped in the specified direction, but won't be unevenly stretched either. I can see that being used in something like a long background image, where you might not want the image to be cropped off the edge of the page, but don't mind it being cropped off the bottom.
@Korcenton
@Korcenton 2 ай бұрын
Exactly! round repeat is perfect when you want a pattern to not crop on the x axis. It'll resize without distortion, leaving a bit of cropping at the bottom of the page -- no biggie! I'm using this for a checkerboard pattern on my site: cropping on the right would look horrible, as if you're supposed to scroll horizontally. round repeat fixes that; it's space repeat without a gap :D
@klemensforster
@klemensforster 8 ай бұрын
Round is actually insanely useful! Imagine all the gaming websites using the cool stone or wood sign textures that begin and end with a texture and have a repeating texture filling the space between. The distortion would not be too bad, but it would ensure the sign to always be seamless.
@complainer406
@complainer406 8 ай бұрын
Until you resize the window and it jumps from 7 copies of the image to 8 Cropping seems like a better option
@slava_trushkin
@slava_trushkin 8 ай бұрын
Round option has one good use I can think of: repeating textures that have one pattern in middle and different on edges. It can also be followed by another element with a texture that fits it perfectly for edge element. I've been designing theme for RPG forum many years ago, this would have been so perfect.
@blu3tan
@blu3tan 8 ай бұрын
background-repeat: space is mindblowing 🤯
@aram5642
@aram5642 8 ай бұрын
(In your life, find yourself a friend who'll greet you the way Kevin greets youtubers.)
@knaughtilus
@knaughtilus 8 ай бұрын
Did a project for school last year (it was movie/cinema related) and I wanted a decorative stripe resembling an old school film roll seperating my image and text on a card. I wanted a fixed width for it so I utilized background-image. My teacher wasn't happy that the shape was cropped at the end (as background-repeat usually does) and since I didn't know the height of the card background-repeat: round; really came in handy :) Bonus was that you can use it for mask-repeat too, so i threw a nice gradient on there as well. Sorry if you can't follow my description, I'll try to put it in a codepen later if I have the time :D but I found that a very good - and until today only - use case I ever had for it.
@CirTap
@CirTap 8 ай бұрын
I can see 'round' used with evenly spread grids where a background (svg maybe) "covers" the grid items which are otherwise unstylable. One could mimic border effects or separation lines between these virtual grid or flex items if the elements themselves are irregular but evenly spaced out. I recall a mini gallery where I had to mess with linear gradients and custom props to get simple separation lines between the gallery items that followed the size and width of the container. Messy business 😅
@chrispaschall5507
@chrispaschall5507 8 ай бұрын
These background repeat properties are cool. The star example was pretty good, but if it were me, I’d probably just get the svg code of the star, make a symbol tag of its code, and have JavaScript render SVGs with use tags in the DOM using a for loop that would execute every time the select field changed. Then let the flexbox gap property take care of the spacing from there after the stars are rendered. Less math involved that way.
@Mr.RobotHead
@Mr.RobotHead 8 ай бұрын
I remember the olden days when we used to have a background image that we'd repeat to make a nice tiled pattern. `round` is probably useful to keep those tiles _close enough_ to the original aspect ratio without cutting off a bit of the pattern. I can't really think of any other use, though.
@daviddonachie5333
@daviddonachie5333 8 ай бұрын
I know! That comment that everyone just uses "cover" is so much a thing of our big-bandwidth era. When I started, it was all about making 10px textures and then tiling them ... or 2px textures even! The idea of a non-repeating background was the werid thing.
@vincentjacquet2927
@vincentjacquet2927 8 ай бұрын
Nice demo. I would only add "print-color-adjust: exact" on the rating element to better support printing.
@BrankoStancevic
@BrankoStancevic 8 ай бұрын
Cool feature, thanks! Have fun animating star rating example! :D I actually have some thoughts, but I need to try those out first.
@kirillsukhomlin3036
@kirillsukhomlin3036 8 ай бұрын
You could have your logo rotated to connect edge points of 'f' letter. So background-repeat: round works with repeatable textures like that.
@jacobwwarner
@jacobwwarner 8 ай бұрын
Regardless of supporting or opposing this, it will be really interesting to see how they restore the land previously submerged in the resevoirs. Also, they mentioned the two dams remaining in OR to mitigate flood waters, but what about the communities downstream in CA? I'm unfamiliar with the area, but Im curious if those small towns could be at risk of major floods if theyre not high enough above the rivers.
@MyDpop
@MyDpop 8 ай бұрын
I learn something new every time, thank you Kevin. 🤟This reminds me a bit of *border-image* . Another exotic and lost property 😏
@Matt23488
@Matt23488 8 ай бұрын
you could use `round` to take a simple image that perfectly tiles visually with itself to create some background patterns that are dynamic based on your resolution and aspect ratio. That could be kinda cool.
@GerritforBazeja
@GerritforBazeja 8 ай бұрын
I used "round"for an image that was just to small to cover my background part for content. Not jet online.
@codclever
@codclever 8 ай бұрын
How the hell did you send this comment if the video was sent on 11:22 PM IST
@bharatbaraiya7552
@bharatbaraiya7552 8 ай бұрын
​@@codclever Same question bruh😮
@drumming_cat
@drumming_cat 8 ай бұрын
this video was posted an HOUR ago but this comment is from a DAY ago???
@mikaockerman832
@mikaockerman832 7 ай бұрын
Before I hear your use cases. I could see using round on abstract type images where aspect ratio is not as important, perhaps with a semi transparent overlay to dim them a little and set them as decoration behind some display images, like perhaps products or something.
@kaustavroy6542
@kaustavroy6542 8 ай бұрын
That is such a good use case. Thanks Kevin.
@Thor6398-jt4mb
@Thor6398-jt4mb 8 ай бұрын
Wait, have you always been saying "front-end friends"? I thought you said "friend and friends" 🤦🏼‍♂️
@Tiger__Man
@Tiger__Man 8 ай бұрын
😂😂😂😂 yeah i just now realise also
@salad_txt
@salad_txt 8 ай бұрын
Hahahaha I thought it was just me!
@BliitzPint
@BliitzPint 8 ай бұрын
Haha same here :D
@luca.pettinato
@luca.pettinato 8 ай бұрын
Me too
@olinadeimbakar
@olinadeimbakar 8 ай бұрын
Guilty too😂
@PacificDev
@PacificDev 8 ай бұрын
Great stuff as always! Kevin 👋 how did you manage to hide that little oblique bars on the bottom right corner of the resizable element?
@Novacification
@Novacification 8 ай бұрын
Another use case for space would be a background of sponsor logos. Maybe you have a sponsored event that needs a promo page with logos in the background and a small info box with event details in the middle. Sponsors don't care if it looks natural, they want their logo to be as visible as possible and preferably not cut off anywhere. You see this pattern used in the real world all over the place, e.g. in sports or at a red carpet event.
@VideoNOLA
@VideoNOLA 7 ай бұрын
You should add a giant "CSS Cheat Sheet" wall poster to your merch store!! Leave nothing off!
@eccenux
@eccenux 8 ай бұрын
Space would work nice for most backgrounds that are covered by content. So there is some pattern on the left, content, pattern on the right. And you want the pattern to align to the sides. You can kind of cheat now and do two backgrounds, but using space would be so much easier 🙂
@atrus3823
@atrus3823 8 ай бұрын
Background repeat round might work pretty well for a grid. I guess the lines stretching might look weird, but maybe it wouldn't be that noticeable. I think I'll try it out at some point
@mannixmd
@mannixmd 8 ай бұрын
Kevin blowing my mind one video at a time :D
@mansurhamidov2319
@mansurhamidov2319 8 ай бұрын
For gap to work properly it shouldn't be more than quarter of star-width. Just simple math there could work. Like computed gap: max(var(--gap), calc(var(--star-width)/4))
@yanexy
@yanexy 8 ай бұрын
repeat: space is a beauty, and your implementation also ☺
@PascalHorn
@PascalHorn 8 ай бұрын
One random semi-related fund of my last few weeks was, getting background color on an image to get it perfectly "scaled" to a parent box. Like: .parent { display: flex; justify-content: center; align-items: center; width: 200px; height: 200px; background-color: #ccc; } .parent img { width: 100%; height: 100%; padding: 20px; border-radius: 15px; box-sizing: border-box; object-fit: contain; // Magic; background-color: #fff; // } Even if the image has a random size like 200x100 pixels, this will fill the rest up with the background-color of white in this case. It becomes a filler color. With that logic, even a background-image like a radial gradient and background-size: cover should be interesting. And yes, the border-radius and padding on the image will be placed at the corners of the 200x200 pixels of the parent. Love these random stuff you learn after years and years along the way.
@nielslytzdk
@nielslytzdk 8 ай бұрын
A fun little demo, but I would not use this specific example in production, you are taking away data from the DOM which is critical for accessibility by rendering the stars as a background image. But still glad to learn new features that I didn't know existed 👍.
@DerClaudius
@DerClaudius 8 ай бұрын
You can probably use it to implement different kinds of 9-patch-scaling if you set multiple backgrounds
@_dinesh
@_dinesh 8 ай бұрын
wow learned so much in this video. I didn't know you could set css variables from js by `document.body.style.setProperty('--star-count', e.target)`. Nicely done!.
@gizmostudios
@gizmostudios 8 ай бұрын
Also good to know is you can get the CSS properties with style.getProperty() :)
@domanickharper
@domanickharper 8 ай бұрын
all this time, I thought he said friend and friends but front-end friends sounds nice too, a friend none the less
@TheLastSeason
@TheLastSeason 8 ай бұрын
Thank you Kevin! I love your videos)
@Maseschine
@Maseschine 8 ай бұрын
For the space and round function I can see image textures coming to websites as their backgrounds.
@BGdev305
@BGdev305 8 ай бұрын
Would have really been nice had you thrown some css fade animation. And 2x as nice with a fade and a growing size transform!
@VE0003
@VE0003 8 ай бұрын
2:24 or a square background texture/pattern that perfectly tiles
@ellopropello
@ellopropello 8 ай бұрын
css is getting better and better :)
@Psyzenn
@Psyzenn 8 ай бұрын
Maybe round for animations ? Like some cool distortion effect.
@sunflair-wa
@sunflair-wa 8 ай бұрын
I have a question. Using your star example, would you be able to use a clip path for the repeating image, or even a background-image of a radial gradient using a background size? Asking for a friend, which is me. :)
@harshbhardwaj6060
@harshbhardwaj6060 8 ай бұрын
Is it good using SVG's to create some moving things or should we use CSS for that. Whats your take on those people doing svg craziness.
@jamescat2386
@jamescat2386 8 ай бұрын
something makes me think if it was a high enough star count (so it's fine in this example) then you could instead of distributing the space, fit another star in, I mean obviously it's fine in this case but at a certain scale it breaks (maybe?)
@Noritoshi-r8m
@Noritoshi-r8m 8 ай бұрын
Have you done a How to make a proper Header video? I always struggle with background images x_X
@blokche_dev
@blokche_dev 8 ай бұрын
There's so much we can do with backgrounds.
@justingolden87
@justingolden87 8 ай бұрын
You should make a fef hat that would be dope
@peterhorvath6859
@peterhorvath6859 8 ай бұрын
You could make a video on how to format a plain numeric cell value with thousand separators in css only! 1234561234123456781234567890 No js, no html modify. Or why not possible?
@outpost31737
@outpost31737 8 ай бұрын
You can use background-repeat: space repeat;
@aseemanand1
@aseemanand1 8 ай бұрын
How does your video work in PIP mode on youtube?
@Komentujebomoge32
@Komentujebomoge32 8 ай бұрын
Have anyone any idea how to make button which appears on some scroll level, and by still going downwards it sticks into the place where it appeared? I am asking because I am working on button which takes us after click at the TOP of website, but by trying many own ideas and by trying looking for answers in the NET I barely can find anything about this topic.
@druharper
@druharper 8 ай бұрын
Nuggets of wisdom :)
@muchis
@muchis 8 ай бұрын
interesting, i learned something, but at the end that was honestly an overengineered flex + gap 😅
@muhdkamilmohdbaki7054
@muhdkamilmohdbaki7054 8 ай бұрын
It puzzles me why I never watch any magician does CSS on their shows. The amounts of tricks they can perform are limitless and I still can't understand how they do it. All of these are beyond magic to me🤭😅.
@BliitzPint
@BliitzPint 8 ай бұрын
Wait, you can set custom attributes on HTML tags and caculate with their values in CSS?? What is that magic??? 😮How does it work? How is it called? I want to know more of that.
@kirillsukhomlin3036
@kirillsukhomlin3036 8 ай бұрын
If the gap is more than 1/nth of the size of the image (star), one won't be able to put more than n stars. Maybe even less (depending on how round is implemented). This example is a little artificial.
@andriydamon8388
@andriydamon8388 8 ай бұрын
do you know React?
@KevinPowell
@KevinPowell 8 ай бұрын
I have used it, not sure if that means I know it though 😅
@markboots_
@markboots_ 8 ай бұрын
Am I a nerd already knowing those values?
@KevinPowell
@KevinPowell 8 ай бұрын
Most definitely 😆. But that's okay, at least you remember them. I actually did a short on `space` awhile back, and then completely forgot it existed until recently 😅.
@RobertMcGovernTarasis
@RobertMcGovernTarasis 8 ай бұрын
No not avFeF, a KP acquaintance
@RobertMcGovernTarasis
@RobertMcGovernTarasis 8 ай бұрын
Virtual)
@marsovac
@marsovac 8 ай бұрын
This is very overcomplicated for something that just needs to show from 1 to 5 stars :P
@TimeFlyBy
@TimeFlyBy 8 ай бұрын
That logo hurts my eyes...
@the-real-pawook
@the-real-pawook 8 ай бұрын
idk if it's tiktok's bad influence or just me being weird, but I was instantly offended by having to watch 15 minutes of the video where it could have been a Shorts clip
@devileyes4u
@devileyes4u 7 ай бұрын
IT'S PERFECT!!! using in prod, thank you Kevin you are CSS hero!
Obscure HTML elements that almost no one uses (but should!)
12:35
Kevin Powell
Рет қаралды 100 М.
CSS position deep dive
28:14
Kevin Powell
Рет қаралды 105 М.
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 133 МЛН
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 68 МЛН
MAGIC TIME ​⁠@Whoispelagheya
00:28
MasomkaMagic
Рет қаралды 38 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 275 #shorts
00:29
Center the bottom row when using grid auto-fit
26:54
Kevin Powell
Рет қаралды 11 М.
How programmers flex on each other
6:20
Fireship
Рет қаралды 2,5 МЛН
CSS-Only Page Transitions That Will BLOW Your Mind!
4:13
Hemant Dutta
Рет қаралды 2,3 М.
Relative colors make so many things easier!
13:16
Kevin Powell
Рет қаралды 51 М.
Write less code with these 5 CSS tips
15:38
Kevin Powell
Рет қаралды 49 М.
One CPU To Rule Them All - Ryzen 7 9800X3D Review
12:47
Linus Tech Tips
Рет қаралды 975 М.
Unfamiliar CSS patterns that improve on the classics
22:57
Kevin Powell
Рет қаралды 48 М.
How to take control of Flexbox
16:01
Kevin Powell
Рет қаралды 140 М.
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 133 МЛН