10 modern layouts in 1 line of CSS
Vložit
- čas přidán 14. 07. 2020
- In this dynamic talk, Una goes over the power of modern CSS layout techniques by highlighting a few key terms and how much detail can be described in a single line of code. Learn a few layout tricks you can implement in your codebase today, and be able to write entire swaths of layout with just a few lines of code.
Resource:
Check out the demo website: 1-Line Layouts → goo.gle/2ViY1KE
Related Playlist:
Day 3 → goo.gle/WDL20Day3
Subscribe to the Chrome Developers → goo.gle/ChromeDevs
Speaker:
Una Kravets
#webdevLIVE #CSS #weblayout event: web.dev LIVE 2020; re_ty: Publish; fullname: Una Kravets; product: Chrome - General; - Věda a technologie
Me: Probably another library or something..
Video: "place-items: center;"
Item: **Actually centered**
Me: **Standing ovation**
i still cant center without checking the browser window
Come on, another library? You could've used align-items: center; justify-items: center; for many years, this is just a shortcut.
@@jerzyglowacki it still doesn't work sometimes :'(
@@aniketmishra9265 When?
@@jerzyglowacki isn't that flexbox? Not grid?
02:06 01. Super Centered
place-items: center
03:03 02. The Deconstructed Pancake
flex: 0 1
04:36 03. Sidebar Says
grid-template-columns: minmax(, ) ...
06:12 04. Pancake Stack
grid-template-rows: auto 1fr auto
07:45 05. Classic Holy Grail Layout
grid-template: auto 1fr auto / auto 1fr auto
10:04 06. 12-Span Grid
grid-template-columns: repeat(12, 1fr)
11:47 07. RAM (Repeat, Auto, Minmax)
grid-template-columns: repeat(auto-fit, minmax(, 1fr))
13:56 08. Line Up
justify-content: space-between
16:08 09. Clamping My Style
clamp(, , )
18:35 10. Respect for Aspect
aspect-ratio: /
Thanks for summary
Are you an angel? 😇😇
The real MVP
@
Google Chrome Developers This deserves a pin. :)
Ty
justify-self: center
justify-content: center
justify-items: center
align-self: center
align-content: center
align-items: center
line-height: 100%
text-align: center
margin: auto auto
vertical-align: middle
*place-items: center*
10 vs 1
..and they don't stop coming, and they don't stop coming...
(fitting with your pfp)
Can I add one more?
position: absolute
top: 50%
left: 50%
transform: translate(-50%, -50%)
I felt this.
lolz i have used all these values
yes i can finally center in css
only working on chrome browser
Display flex, align item center, justify content center.....go nuts!
@@VipinSharma-mr7sq works everytime
@@GergiH who the **** cares about IE4, even CZcams don't support it.
@@VipinSharma-mr7sq height : 100vh; is required to center it vertically.
This video improved my life expectancy.
lol
😂
Imagine showing someone from 20 years ago how easy web layouts would be in the future :)
I'm from future, in 20 years, everything will run and support the web. PWA is just the tip of the ice burg.
@@BodawalaPratik in 20 years from your future web layouts will be made by AI
Actually, 20 years ago we didn't have to worry about responsive layouts
@@DineshkumarPuli Just embed flash in an object set to 100% width and scale being exactfit.
I am from 20 years ago.
I once tried to explain to someone at a job fair that manually centering a button was one of my earliest proudest moments in web development. I don't think they understood.
They'll never understand...
The happiness you are radiating in the video makes everything easier to understand.
I'm only 4:30 in and already this is the most useful CSS tutorial I've come across in weeks of trying to come up to speed on where the web has gone in the 15 years since I last dabbled. Fantastically simple and straightforward presentation too. No useless fluff. Just dive into the details with visually compelling examples.
Incredible. The level of sophistication and simplicity in modern CSS takes my breath away.
I need to kick my flexbox addiction and start using grid as well
honestly this 21 minute video saves a lot of my time ! and the vibes while you explain things make it more exciting to do ! I love this, thank you so much.
Watched this video two weeks ago and today I had to use one of these valuable nuggets. Keep learning....you never know when and where you will need to apply what you learned.
Probably the most important CSS video for modern web I've ever come across, thanks!
So true... I have to say though, I was looking for the IE11 fixes but then the video did say "modern layouts". IE11, the bane of my life! >''
@Data I hear @Data, sadly sometimes, clients want compatibility with old browsers.
One of the best CSS layout videos that I've ever seen!
Agree. I hate CSS but the way she simplifies it makes me actually want to use it.
Agreed.
True =]
There are some real gems here. I'm always coming back to watch this video again and check out the demo link
I love this!! I've had many frustrating experiences trying to center simple items. This really explains layouts well!
10 modern layouts in 1 line of css:
she minify it
lol. underrated comment.
@@shriniwasrocks this guy is crazy !!
@@billsomen7953 And yet - it's true hahahah
My entire website in one line lmao
hahahhahaha
Thanks for this great tutorial! You're very good at breaking down the concepts behind the tricks. This will make my life a lot easier, since I'm currently experimenting with some frontend technologies without a lot experience in it.
Hey Una,
that Video is awesome!
Simple, straight forward, very nailed information without talking-overhead and very useful hints.
I bet this will save me many hours of effort in the future.
It's the best Video I've seen about CSS-styling for a long time!
I've been looking at that little happy smiling face in the recommended videos for quite a few days, but only today I got the planning to watch it and I'm glad I didn't postpone it more. That was a really cool bunch of tips that I'm going to write it down and use it right away. I may have already know the couple of flex ones, but got much more from this than I hoped for. Seriously, what a cool format and straight forward way of presenting them.
I'm not a design person, so whenever I try to do a design mock-up I have to write many lines of code and even that doesn't give me satisfaction on my work. But after watching this, I think my work can be reduced a lot. can't wait to try this out. Really nice presentation. Thank you for these great tips!
You should try a Prototyping/UI Design software like Adobe XD, Sketch or Figma. Figma has a free tier and Adobe XD is entirely free, give it a try (not as hard to learn as other Adobe programs luckily)
@@carldressler3262 thank you so much for your suggestion. Yeah surely I'll give it a try.. 👍
I'm sorry if this is annoying but is your name a flipping JoJo reference. Nice!
@@shivanshkumar3754 man another freaking jojo fan
KAKATANA AHOGA! THUNDER CROSS SPLIT ATTACK!
@@xatoor What is "Jojo"?
Don't apologize for the titles of your layouts. You've made it a LOT easier to remember them :)
Your enthusiasm is contagious! Thank you
This is one of my favorite videos, Una is an awesome presenter and teacher.
I've never been more ashamed in the lack of my CSS knowledge.
same bro haha
Just when you think you know web development......here comes CSS with some new properties you never saw in your life
same here
I now prodly hate every css article I've ever read.
I used to be angry because I thought I was stupid, it turns out not only am I stupid, but every css blog author is also stupid.
You don't have to be ashamed, some of these tricks became fully supported by mobile just days ago, so consider yourself on the cutting edge here.
Simple, practical, clear and concise. Love it!
I've switched from doing websites back in 2008 to strickly a back-end dev. It's amazing how much things have changed and the newer CSS features. THANK YOU!!!
what an incredible presentation. i have been having an issue with centering something in my portfolio and you saved the day!! so happy to have randomly found this.
Nice vibes :) You are so happy and seem to have a perfect fitting job Una. And great content too.
that centered element is what I was exactly looking for!!!! I've been so perplexed by that one!!!!
this is by far the best css video I've seen, exactly what I needed.
This is literally the most helpful practical and practical css guide I've ever seen
This video is so straight forward and well explained. Saving forever
This is both amazing and exciting.
I learned a bunch of new techniques, thanks.
Great video!! Had to save this to watch later cos we all know I’ll forget how to implement this by the time I’m done with my web dev course. Thank you!
Much appreciated, doing something so simple that other people never thought of doing it... Please keep posting these useful tips, It will help a much larger community on a global scale.
Thanks for such a simple presentation
cheers :)
Sooooo useful & Una is an amazing presenter. Thank you!!!
Thank you Una - this was wonderfully explained and presented
I keep coming back to this video and use it as a small CSS cookbook. Thanks for the video and the tips!
Thank you for this great video. I'm coding for years and it is nice to learn every day some little helpful things which make the developer live easier. I hope the aspect-ratio will implement in all browser very fast. The clamp property I didn't know about it but it has enormous potential for many projects in my future work.
Woah, It's been a long time since I've seen Una, I remember using your css based Instagram filters back in the day! Really nice to see you as part of google now. 🙌
Great and wonderful! I am updating my knowledge, but I would appreciate the way you speak, you let other people be interested to hear you
Loved it, the most useful 20 minutes of CSS layout tut. Thank you and please make more videos of this kind.
Super informative presentation! I am with you on that aspect ratio, that would be a great addition, can't wait!
What a gamechanger! My life will be much easier when that's common.
Tyler Robb Well you can already set aspect ratios by using padding with a percentage (like padding-bottom: 56.25% (for 16/9)) but it's not that readable. Would be way cleaner to implement it like this
Wow, I learned so much from this video. Thank you for putting it together.
Thanks for sharing. I've tried some grid tuts and I like your component approach lots, lots more. Can't wait to play.
I also can't wait until clamp is fully supported. It'll make responsive font sizing *soooo* much easier.
I love your positive attitude and the useful tips you show us. Thank you !
You don't know how long I have been doing the ol' position:abs top:50% left:50% and finally transform:translate(-50%,-50%) to center things XD
I still do the same
Before watching this video, I thought this was still the modern way to do it…
Actually, when trying out `place-items: center;`, the child is not actually centered if the parent is smaller than the child. With `translate`, it still works!
It really depends on the context of the situation, the solution you use works basically 100% of the time but the place-items: center; option only works sometimes which is why I tend to stick to the same solution
@@woutermissler5371 dont go for place item rather use flexbox or more better grid
I just had to deal with something that may be a bug in Firefox: when centering elements with the `translate` approach, it seems that the _print preview_ still considers the extra space created by the `left` and `top` positioning, even if everything should be centered on one page; the extra space completely break the paged media layout. With the Grid centering, no extra space is created at any point, so only this works.
possible to add more then 1 like? i think i missed 10 years of css updates
same! I was in another tab searching like "is this flexbox thing a .js that I have to call first or what"
I thought I was alone. I feel less ashamed now... lol
Well most browsers mobile devices still dont have the updates required to support the css she tought .........So you are all good mate LEGACY CSS is still very much CURRENT
Amazing content, Una, and fantastic job explaining the modern CSS techniques - Thank you!
Thank you for the information. I found that your enthusiasm and presentation style made the video fun to learn.
This was amazing, had me smiling. So simple!
Thanks, Una, awesome as usual!!
This video is a godsend. After hours of scouring stack-overflow for continuously more convoluted solutions that don't even work properly, this video finally showed me how to actually do what I wanted properly.
The css lines are so awesome and amazing sharing. thanks a lot!
Love the passion here!
The aspect ratio one is gonna save me a lot of trouble dealing with International Paper Sizes
This is a great video! I constantly tell people to use CSS grid. It's great. And you are wonderful, you personality if perfect for videos, very cheerful and accessible.
Fantastic job Una, thank you for preparing these super helpful examples.
The aspect-ratio property is definitely a life-saver in the making. Hope it will come to each browsers near soon.
Won't padding-bottom: calc(9 / 16 * 100%); save your life?
As a total noob it's actually good to see that others struggle with the same things as I am struggling with.
nice. Firstly thought it would not be such easy and helpful. But even with all my experience found new things and it was just pleasure to watch this video. Good job!
MOOOOOREEE! This was such a useful video packed with good information and even better explanations!
This is like the holy grail of videos ever - A backend engineer
This is like the holy grail of videos ever - A dude that does full-stack currently. I didn't even know any of this and I'm knee-deep in CSS at least 10 hours a week...
Una, thank you
This was such an amazing review! I never understood clamp until I saw this video.
Thank you very much!
This is superb. And I thought the Array Methods Song would be a hard act to follow! I am sending this link out at the end of my React course this week as all delegates were hungry for layout- despite being there for JavaScript. Delighted to see an aspect-ratio setter finally going native after wrestling with own workaround for long enough.
CSS aspect-ratio!!! MAKE IT HAPPEN!!! I'm so excited.
Same here, probably one of the most needed properties for CSS!
padding-bottom: 56%
Pavel Ivanov I’ve been using that (56.25%) for now. This will he so much easier, especially for other ratios.
@@RideTheTeacups It's easy - for other ratios like 4/3 just use padding-bottom: calc(3 / 4 * 100%);
Amazing stuff. I had no idea Grid could do all that! Who needs Bootstrap ??
Una !
Thank you so much! This is great material and very nice way of explaining things.
Una, thank you for this content. Very helpful!
Absolutely smashing. Not a media query in sight. This pairs perfectly with Andy Bell's CUBE methodology. Thank you! By the way, who downvotes a wonderful video like this?
google haters, who knows?
This is earth and all kinda creatures are found here 😂
i'm a media query guy myself tbh
if you go the bespoke route, not using css frameworks then media queries are inevitable.
Iroh once said that you must center yourself before you center in css.
I loved this video, so enlightening. Hope the clamp and aspect-ratio get full support soon!
This is what all web dev tutorials/training should look like. Thanks! Please make a full course on practical CSS.
you are so good at this 👏 just amazing to watch
Completely agree. A natural presenter with excitement, simplicity, and deep experience.
Best thing is to see how much fun she has doing that stuff
I believe I saw your photo on freecodecamp.org
My Aspct-Ratio is clamping me ! ^_^ ! - thank's a lot for publishing - cool layout possibilities!
this is freaking amazing! Thanks Una!
Wow!!! It's amazing!!! There're many simple ways to improve our layouts! Thanks to share it!!!
Who remembers rounding corners with images? >.
Image slicing!
I remember adding rounded corners using VML in IE!
And then putting them in tables ! Good times :D
@@Liath666 Oh, I remember those days.
and SlidingDor for button
Who still remembers the tag?
Remember it? Google still uses it on their home page. I kid you not!
@@justinbennet9050 that's because they want it to display properly on EVERYTHING.
Oh damn I forgot about it!
This tag does not center vertically... Centering horzintally was never a real problem.
i am sure i will never find a better lesson in css than this one! thanks a trillion!
Mind blowing, the number of lines i have to type to get this same results. Thank you very much
eagerly waiting for aspect ratio to be implemented. I'm still using "padding-top" on parent and "display absolute" on child to get this done :(
Thanks. Very helpful.
10:47 we can use grid-column: 1/-1;
Great tips, I do'nt knew the place-items, clamp and aspect-ratio, thanks Una!
Great info - thanks! And also, big thanks for your wonderful energy!
finally, i can center my fricking button
We are in 2020, still not able to figure out how to center things in HTML/CSS 🤣
Just put everything within a tag and you’ll be fine.
Display: flex; justify-contnet: centre; align-items: centre OR use auto margins. Also firefox is much better for working out what css doenst work.
@@maxclifford937 in mid 2000's i use to use float: right then move left half value of the width like
.t {
width: 100px;
float: right;
left: -50px;
}
this works but its a pain to align children please do not use this way
@@ryonagana and there was stupid clearfix solution etc. grid and flex layouts save us a lot.
Pff, easy. Just keep adding in front of the element until it's roughly in the center of your screen.
I have only seen five minutes of the video and I am really impressed!
Crisp and powerful.Excellent presentation
18:35 10. Respect for Aspect
- without newer features this is currently handled by using percentage padding hacks with absolute positioned children set to 100% width & height. Where the percentage padding is the aspect ratio.
i think the whole point of this feature, is to make this easy to do
@@thirien59 I think the whole point of @Paul Newton's response is to inform people how it's currently done, which wasn't included in the video
@@thirien59 support isn't guaranteed, this is the arcana of the old ways from a less elegant age
The aspect-ratio property, I want it right now. Right bloody now. God that’s convenient.
Every time I think I know CSS, a video like comes along to show me new stuff and creative ways of using old stuff
Months ( years? ) after visionning this video, that place-items : center finally saved me in a big company project :) . Transform translate (-50%,-50%) often makes content blurry because of antialiasing and other stuffs I guess so this simple css property is way more cleaner and finally feels like "the right thing to do" ! Thanks a lot
waiting for full aspect-ratio support!
I didn't even know contenteditable existed 😭
Right? I’ve failed 😔
Love CSS because of you, thank you! ❤
This 20 minutes video will save me 20 hours of writing media queries in my next project❤️
122 dislikes!!!
What kind of people are they?? I guess they don't like their things centered.
Maybe people who stuck having to support IE / Safari lol
Maybe people who were making money of these tips and now see their income go down. lol
ppl who expected to type in the terminal 'make website like facebook pls'
@@shocked-curry-omelette My view on supporting IE: If it barely works, then it works.
Safari I'll grudgingly make exceptions for, even though it's a pain. IE has used up any patience I once possessed.
The reason for DISLIKES is she tought like the CSS is compatible with every browser or device .........its not .. well not yet ..