And remember our image example? Are you starting to see a pattern here? A lot of times when we're writing our HTML properly, you're going to end up providing value in multiple ways. Here if a screen reader lands on our image, the person will actually get to hear what the image is showing. It's just another low-effort way to help everyone experience the website.
Lists are also a practical use of HTML that's used across the web. But far too often, I see code that logically is a list that's not using HTML list elements. Next time you create a navigation for your app, don't use a bunch of divs. Use the actually HTML list elements. This will actually help assistive technology assist the people who are using it. And they're not much harder to style. Just set your list style of your UL to none, and you're practically where you were when you're starting off with a div.
And lastly, we'll talk about simplicity. And what do I actually mean by simplicity? We don't always need extravagant solutions to get our code to work the way that we want it to. Sometimes there's a simpler way to do things that we're struggling to do in JavaScript. You don't need to rewrite the HTML spec every time you add a new component. More often than not, the more JavaScript that you write means the more JavaScript that you ship, which can impact the performance of your app. Use what we already have, it's also less work. Like here, the data list element, we can create a basic autocomplete feature for an input. You also don't need to write JavaScript to create a simple loading animation that you might see on some of your favorite websites. Using some CSS, we can use a gradient and an animation to create this effect. It's just a small snippet here. Better yet, having it as a class, we can extend it to pretty much any element that we want. And if I asked you how you would make this text responsive before you actually saw this, how many of you would jump right into JavaScript? We can actually do this quite nicely with some simple CSS. Here, I'm setting the font size of our H1 to 10 viewport width. It might look a little bit choppy in the slides between having to say this out as a GIF and presenting it across the Internet. But I promise you, it's buttery smooth. That way, it scales nice and evenly with our browser. And bonus, if it gets too small, we can use media query breakpoints and keep it all in CSS.
So how are you feeling after all of that? I hope inspired. There's a lot you can learn without diving head in first into JavaScript. If you take all those things into consideration, you're going to be better off as a developer. Not only will you help yourself by avoiding to over engineer solutions, which can typically bring on more stress, you're going to help yourself bring more traffic to your projects and help others use them. If you want to learn how to go from end to end from design all the way up to a full stack Next.js application, include building out those components with the fundamentals along the way, Check out my free course on YouTube. Where you can find it at from design to.dev. And that's it. If you want more, you can find me everywhere at ColbyFayok. I'll also send a link with some of the information you've seen here today. Thanks everyone.
Comments