Dev Dive In
Dev Dive In
  • 51
  • 55 512
This Should Have Been In CSS Years Ago
Learn how to center content in CSS easily with this simple tutorial. Say goodbye to hacks - this should have been in CSS years ago!
มุมมอง: 34 173

วีดีโอ

How to Setup Up a Component Library with React, Vite, Storybook and Tailwind
มุมมอง 622หลายเดือนก่อน
Unlock the power of React with ease! Dive into the world of component libraries with our step-by-step guide on using Storybook, Vite, and Tailwind CSS. In this comprehensive tutorial, we'll walk you through setting up a robust development environment. Whether you're a seasoned developer or just starting out, this video will equip you with the tools and knowledge to streamline your React compone...
Sign Spinning: JavaScript Buttons That Turn Heads
มุมมอง 4672 หลายเดือนก่อน
In this fun video, we use JavaScript to create a button that spins a sign to get a user's attention. We make use of Rive for the animations and integrate those animations into our site. Github Repo: github.com/dev-divein/sign-spin Try it out: dev-divein.github.io/sign-spin/ Rive Documentation: help.rive.app/runtimes/overview/web-js #Rive animation
JavaScript Hijinks: Mouse Cursors Swarm Your Screen!
มุมมอง 1K3 หลายเดือนก่อน
In this video, we'll create a fun mouse follower using JavaScript and CSS. This effect isn't really meant for production, but instead a fun little project to learn JavaScript concepts. Boid CodePen: codepen.io/devdivein/pen/XWQdypy Boid CodePen: codepen.io/devdivein/pen/rNRgegK Ben Eater Boid Implementation: eater.net/boids Smarter Everyday Boids Episode: th-cam.com/video/4LWmRuB-uNU/w-d-xo.htm...
How to Create an Award-Winning Mouse Follower With JavaScript
มุมมอง 8354 หลายเดือนก่อน
Create an image mouse follower, and have a little fun doing it. In this video, we recreate a mouse follower from an award-winning site. (www.studiosabia.com/) Feel free to fork and share any CodePens. We look forward to seeing what you come up with! Mouse Follower CodePen: codepen.io/devdivein/pen/qBvMava Cat Mouse Follower CodePen: codepen.io/devdivein/pen/KKEJxKp Scared Mouse Follower CodePen...
Make an Award Winning Scroll Effect Using ONLY CSS
มุมมอง 4.1K4 หลายเดือนก่อน
Make an Award Winning Scroll Effect Using ONLY CSS
Silky SMOOOOOTH Effect Using StyleX and React
มุมมอง 1.1K5 หลายเดือนก่อน
Silky SMOOOOOTH Effect Using StyleX and React
Stop Your Code From Stinking: 5 Code Smells
มุมมอง 6876 หลายเดือนก่อน
Stop Your Code From Stinking: 5 Code Smells
JavaScript Basics in 5 minutes
มุมมอง 1327 หลายเดือนก่อน
JavaScript Basics in 5 minutes
How to Create the Holy Grail of Layouts: CSS Grid
มุมมอง 2.3K7 หลายเดือนก่อน
How to Create the Holy Grail of Layouts: CSS Grid
A Step-by-Step Guide to Styling Websites: CSS Made Easy
มุมมอง 2488 หลายเดือนก่อน
A Step-by-Step Guide to Styling Websites: CSS Made Easy
Comparing LARGE Amount of Text? VSCode Tip to Save Time
มุมมอง 248 หลายเดือนก่อน
Comparing LARGE Amount of Text? VSCode Tip to Save Time
HTML Basics: 4 HTML tags you'll use on every website - Part 4
มุมมอง 1328 หลายเดือนก่อน
HTML Basics: 4 HTML tags you'll use on every website - Part 4
HTML Basics: Heading and Paragraph tags - Part 3
มุมมอง 1018 หลายเดือนก่อน
HTML Basics: Heading and Paragraph tags - Part 3
HTML Basics: How to create your first website - Part 2
มุมมอง 8939 หลายเดือนก่อน
HTML Basics: How to create your first website - Part 2
HTML Basics: The First things you need to know to make a website - Part 1
มุมมอง 579 หลายเดือนก่อน
HTML Basics: The First things you need to know to make a website - Part 1
5 Must-Knows for Web Development Beginners
มุมมอง 829 หลายเดือนก่อน
5 Must-Knows for Web Development Beginners

ความคิดเห็น

  • @Impact_TO
    @Impact_TO 20 นาทีที่ผ่านมา

    margin: auto; left the chat

  • @ajayimoses2495
    @ajayimoses2495 6 ชั่วโมงที่ผ่านมา

    Subbed 👍

  • @justmeagain9302
    @justmeagain9302 7 ชั่วโมงที่ผ่านมา

    Wow a new way to center a div... Im sure that one line of code makes an entire difference

  • @dee_jay403
    @dee_jay403 21 ชั่วโมงที่ผ่านมา

    great video, didn't know about this feature! in future videos, i'd love it if you quickly covered the browser support for the feature as well

  • @Blackbirdone11
    @Blackbirdone11 วันที่ผ่านมา

    Thats insane

  • @iLikeCoffee777
    @iLikeCoffee777 วันที่ผ่านมา

    So we finally got something equivalent to the center HTML tag. Hate on it all you want but it was effective and CSS dragged its feet on implementing anything equivalent in simplicity.

  • @quadra5443
    @quadra5443 วันที่ผ่านมา

    they killed div jokes

  • @king_james_official
    @king_james_official วันที่ผ่านมา

    margin auto worked fine for me... what can this do that margin can't?

  • @Minu_Shalom
    @Minu_Shalom 2 วันที่ผ่านมา

    Too easy. This should be illegal!

  • @CEOstar
    @CEOstar 2 วันที่ผ่านมา

    hallelujah

  • @haiffy
    @haiffy 2 วันที่ผ่านมา

    Still prefer flex items-center justify-center

  • @ya64
    @ya64 2 วันที่ผ่านมา

    And it only took... *checks calendar*... 27 years!

  • @dustsucker4704
    @dustsucker4704 2 วันที่ผ่านมา

    Works but I feel like we didn't need another way of doing it. As grid and flex Cover 99.9% of usecases im not aware of elements that have to be Block that have content i dont See the usecase for this.

  • @realdragon
    @realdragon 2 วันที่ผ่านมา

    Me who knows nothing about CSS: This is truly a game changer

  • @HemitPatel-s3f
    @HemitPatel-s3f 2 วันที่ผ่านมา

    dream come true lmao

  • @HemitPatel-s3f
    @HemitPatel-s3f 2 วันที่ผ่านมา

    dream come true lmao

  • @mahmoudzakria6946
    @mahmoudzakria6946 3 วันที่ผ่านมา

    The W3C are working backwards, why it was never defined before Flex/Grid!?

  • @AnweshAdhikari
    @AnweshAdhikari 3 วันที่ผ่านมา

  • @NotJayUU
    @NotJayUU 3 วันที่ผ่านมา

    it's strange you titled the video: "this should have been in CSS years ago".... considering the spec for align-content was released in 2012, and supposed by every browser by 2015 I guess the newness if it's supported in a block layout, but like.... before that is was just 1 additional property "display: flex/grid"....

    • @DevDiveIn
      @DevDiveIn 3 วันที่ผ่านมา

      Yep exactly. We should have been able to vertically center things with block elements years ago. I guess having so many alternatives really slowed progress on having it implemented for block elements.

  • @nustaniel
    @nustaniel 3 วันที่ผ่านมา

    My goto is position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content.

  • @squarshyy
    @squarshyy 3 วันที่ผ่านมา

    What happens when the container has two children? Would it behave the same as flex or grid? Or else?

    • @DevDiveIn
      @DevDiveIn 3 วันที่ผ่านมา

      From what I tried it looks to be the same as flex. The only difference I noticed was how margins collapse. Flex stacks margins on top one another, block merges the top and bottom margins together.

  • @nomadshiba
    @nomadshiba 3 วันที่ผ่านมา

    1:10 thats not correct place-items: center; means: justify-items: center; align-items: center; there is also place-content: center; which means justify-content: center; align-content: center; content is the area of the grid or flex layout where the child item lives in and item is the actual item in that area

    • @DevDiveIn
      @DevDiveIn 3 วันที่ผ่านมา

      @nomadshiba - good call out. That is my bad. I misspoke.

  • @perfectionbox
    @perfectionbox 3 วันที่ผ่านมา

    Someday we'll treat HTML and JS as a dress rehearsal, and take everything we now know and develop a vastly better replacement which will run alongside them in every browser, and after enough sites migrate, we drop the old languages. And throw a huge party.

  • @wil-fri
    @wil-fri 3 วันที่ผ่านมา

    Me: create a row with a column inside. Center that column. Put something in that column. Center the content of that column, voila volare vio

  • @beaticulous
    @beaticulous 4 วันที่ผ่านมา

    Why not content-align?

    • @ytchannel6569
      @ytchannel6569 3 วันที่ผ่านมา

      why not con-align-tent?

    • @mahmoudzakria6946
      @mahmoudzakria6946 3 วันที่ผ่านมา

      Like this's the real problem!?

    • @beaticulous
      @beaticulous 15 ชั่วโมงที่ผ่านมา

      @@mahmoudzakria6946 There was no problem to begin with. However, this naming changes the word order once again. Perhaps there is a reason, but from text-align perspective there is a PHP4 developer naming CSS attributes now. Cognitive load, etc. Naming is the simplest thing to do consistently, but here we are. Wrap this bastard into well named utility classes immediatelly.

  • @OfficialViper
    @OfficialViper 4 วันที่ผ่านมา

    Straight to the point, no bullshit. Subscribed.

  • @zvala396
    @zvala396 4 วันที่ผ่านมา

    This only works with pictures of cats.

  • @fp6260
    @fp6260 4 วันที่ผ่านมา

    We got "align-content: center;" before GTA6.

    • @DevDiveIn
      @DevDiveIn 4 วันที่ผ่านมา

      lol. Should be a metric on MDN and caniuse. Before GTA6: yes.

    • @NotJayUU
      @NotJayUU 3 วันที่ผ่านมา

      we got "align-content: center;" before GTAV.......

    • @gkarapeev
      @gkarapeev วันที่ผ่านมา

      We almost got GTA6 before we got align: center! That’s the weirder part.

    • @julealgon
      @julealgon 2 ชั่วโมงที่ผ่านมา

      Impressive.

  • @iub.9893
    @iub.9893 4 วันที่ผ่านมา

    Perfect

  • @Vendavalez
    @Vendavalez 4 วันที่ผ่านมา

    Oh god… thankfully my brain has forgotten the arcane magic one had to do 10+ years ago to try to center something on a web-page…

    • @NotJayUU
      @NotJayUU 3 วันที่ผ่านมา

      this property came out out over 10 years ago.... so you could just use this

    • @Vendavalez
      @Vendavalez 3 วันที่ผ่านมา

      @@NotJayUU and how many browsers actually supported it, as opposed to just claiming that they did? To be fair, I wouldn’t know. This is more of a me problem, but at the time I needed to support websites that were being accessed in South America where you could only assume that they would have the version of the browser that came with whatever OS they were running. That’s what I was trying to communicate with the “+” but I get that is really not clear at all.

    • @NotJayUU
      @NotJayUU 3 วันที่ผ่านมา

      @@Vendavalez there's a website caniuse, it's good for checking this stuff. 2015 was when it was supported in all major browsers

    • @jerichaux9219
      @jerichaux9219 3 วันที่ผ่านมา

      Now you may begin to heal.

  • @YoKKJoni
    @YoKKJoni 4 วันที่ผ่านมา

    the beauty of css is that prob none of these will work for my purpose XD

    • @theseangle
      @theseangle 2 วันที่ผ่านมา

      So what's your purpose

  • @Rovsau
    @Rovsau 4 วันที่ผ่านมา

    Question: Is there a way today to make a set of divisions behave like a table, where it would dynamically adjust the size of each row and column?

    • @DevDiveIn
      @DevDiveIn 4 วันที่ผ่านมา

      That you can. Using the display property. You more or less mimic the structure of a table with divs. And apply the appropriate display property. e.g. <table> = display: table; <tr> = display: table-row; ... etc. I wouldn't recommend it though. It's a lot easier just to use a table. There is a lot of accessibility goodness when you use the semantically correct HTML tags. If it isn't actually a table, I would look into using display grid.

    • @Rovsau
      @Rovsau 4 วันที่ผ่านมา

      @@DevDiveIn That's very good to hear! Thank you. The problem with using Tables, at least 15 yrs ago when I was active, was how Web Crawlers interpret them. Tables are expected to contain tabular data, and not contextual content. Do you know if Accessibility tools like Screen Readers will be able to handle websites designed with tables today?

    • @DevDiveIn
      @DevDiveIn 4 วันที่ผ่านมา

      @Rovsau - Ya I don't miss those table days, or IE 6 for that matter ;) If the content belongs in a table, then screen readers prefer you use the html tag. When you use a divs by default screen readers lose reference to what other divs belong in the same row/col. You have to do some work to reimplement that functionality so screen readers can read it properly. If you're laying out an entire site. I wouldn't use tables or the div equivalent, there are much better alternatives now. Screen readers would try and read your site as a table which it is not. display: grid does pretty much the same thing as tables (and more), and is much more robust and flexible. I have a video on it if that helps. th-cam.com/video/B6QddhvpUUo/w-d-xo.html

  • @noureddinelevrai
    @noureddinelevrai 4 วันที่ผ่านมา

    Thanks man, straight to the point 🔥

  • @rhiji4583
    @rhiji4583 4 วันที่ผ่านมา

    so Safari might support this 2034

  • @cariyaputta
    @cariyaputta 4 วันที่ผ่านมา

    Failed so many interviews because of this lol

  • @Fido1hn
    @Fido1hn 4 วันที่ผ่านมา

    Why would text-align work on an image. Wierd, it literally says 'text'

    •  4 วันที่ผ่านมา

      Because image is by default an inline element. It is easier to imagine the image as just another big character in the text.

  • @AerysBat
    @AerysBat 4 วันที่ผ่านมา

    There is a new multikeyword display property. display: block flex or display: inline flex will let you specify both the placement and the inner layout. (Why these two distinct features were ever mashed together in one property is beyond me)

  • @Flyde
    @Flyde 5 วันที่ผ่านมา

    This is awesome! Thanks for sharing

    • @guyincognito5663
      @guyincognito5663 4 วันที่ผ่านมา

      Yeah, web design is “awesome”.

  • @albumin30days90
    @albumin30days90 5 วันที่ผ่านมา

    "HOW TO CENTER A DIV"

  • @nested9301
    @nested9301 5 วันที่ผ่านมา

    Lame a**

  • @vahekhachaturian2424
    @vahekhachaturian2424 5 วันที่ผ่านมา

    i still can't believe that this is a thing

  • @jayjaayjaaay94
    @jayjaayjaaay94 5 วันที่ผ่านมา

    Why I see this cat picture everywhere?

  • @etherweb6796
    @etherweb6796 5 วันที่ผ่านมา

    You could also use width 100% height 100% and object-fit also (assuming no other content in div)

  • @perfectionbox
    @perfectionbox 5 วันที่ผ่านมา

    This is why html needs a revamp

    • @cake3014
      @cake3014 5 วันที่ผ่านมา

      Yeah, but the problem with revamping html is older browser support. I never get why there's so much importance on supporting old browsers, especially now that Windows 7 has been discontinued and Windows 10 is going soon too. So the majority will be updated to many recent browsers. But it's a matter of making a website accessible to everyone. We have plenty of frameworks now too. And I know the React peeps won't get over their ex if and when html gets a major revamp. It also depends a lot on bigger corporations that decide on a standard for the web.

    • @Endrit719
      @Endrit719 5 วันที่ผ่านมา

      @@cake3014 people still use windows xp, trust me

    • @snesmocha
      @snesmocha 5 วันที่ผ่านมา

      @@Endrit719then just create a legacy mode that will replace the code with legacy compatible or something, most sites aren’t even compatible with old browsers

    • @giovannibandinelli9792
      @giovannibandinelli9792 4 วันที่ผ่านมา

      ​@@Endrit719 I know that that is the case but I don't get why 😮‍💨😮‍💨😮‍💨

    • @Maleficarum999
      @Maleficarum999 4 วันที่ผ่านมา

      @@cake3014 Not everyone cares about new technology and companies want to deliver websites to maximum amount of people, general population not being tech savvy enough isn't a good argument to abandon backwards compatibility. Yes you can revamp HTML which will work thousand times better than old HTML but try selling a fact that it will only work for 50% of users to any client and get ready to be laughed at.

  • @Mempler
    @Mempler 6 วันที่ผ่านมา

    I love to abuse flexboxes

  • @yerenzter
    @yerenzter 6 วันที่ผ่านมา

    I've already used this since 2019

    • @NotJayUU
      @NotJayUU 3 วันที่ผ่านมา

      ya... this came out in 2012, I don't get why every is acting like this is something crazy...

    • @codyrap95
      @codyrap95 3 วันที่ผ่านมา

      Because if I understood correctly it's not using grid or flex. It works directly on block elements

    • @theseangle
      @theseangle 2 วันที่ผ่านมา

      It was only released on March 19th 2024. It works on display: block. What you were using only worked with display: flex or grid. The support now is only about 79% align-content on display block, unlike the 96% align-content on display flex

    • @theseangle
      @theseangle 2 วันที่ผ่านมา

      ​@@NotJayUU why are y'all acting like some kind of OGs while knowing nothing about the topic

    • @NotJayUU
      @NotJayUU 2 วันที่ผ่านมา

      @@theseangle ?

  • @collapsingspace
    @collapsingspace 6 วันที่ผ่านมา

    place-items is actually shorthand for justify-items and align-items

  • @tediumluvs
    @tediumluvs 6 วันที่ผ่านมา

    Finally.

  • @Voltra_
    @Voltra_ 6 วันที่ผ่านมา

    Not cool to kill a meme Chrome!

  • @totoshampoin
    @totoshampoin 9 วันที่ผ่านมา

    YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSs