Live Stream: CSS 101 (July 3rd, 2024)

Article Author:

Published Date:

Updated Date:

Home » Posts » Live Stream: CSS 101 (July 3rd, 2024)

Takeaways on CSS 101

The Sunrise Show: A Deep Dive into CSS

Today, we’re starting early with a special Sunrise Show, diving deep into a topic near and dear to my heart: CSS. Get your coffee ready because we’re about to embark on a journey through the world of Cascading Style Sheets, its history, its applications, and why it’s such a crucial tool for web developers and designers alike.

The History of CSS

Let’s start with a bit of history. CSS, or Cascading Style Sheets, was born out of necessity back in the early 1990s. “It was invented in 1993-ish by Håkon Wium Lie, who proposed this language because before that, it was only HTML.

And if you know HTML and what it can look like without CSS, it’s pretty much just content.” Enter CSS, allowing for the separation of content (HTML) and presentation (CSS), making the web a much prettier place.

What Exactly is CSS?

For those of you who might not be familiar, CSS is the language used to style and layout web pages. “In very general terms, it is a language that is used to be able to really globally reach styles throughout a website.

It doesn’t have to be WordPress. It can be used on different builders.” Imagine HTML as the skeleton of a webpage and CSS as the skin and clothes that make it look good.

It’s what turns a plain document into an attractive, engaging website.

The Power of Global Styling

One of the key features of CSS is its ability to apply styles globally across a website. “As we mentioned, it’s global. So you target, as long as you have a class for that particular item, you can target it and then make the update.” This not only saves time but ensures consistency across your site.

It’s like having a magic wand for web design.

Flexbox and Grid: Modern CSS Layouts

Two of the most powerful features in modern CSS are Flexbox and Grid. These layout models make it much easier to design complex, responsive layouts without a lot of complicated code.

  • Flexbox: “The newest way I would say is display flex. When you display flex something, you’re pretty much saying it is a flexbox.” Flexbox is great for one-dimensional layouts, like aligning items in a row or column.
  • Grid: “Display grid acts exactly the same way in terms of centering at least.” Grid is perfect for two-dimensional layouts, allowing you to create complex designs with rows and columns.

Here’s a quick example of centering a div using Flexbox:

.center-me {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* Full viewport height */
}

The Versatility of CSS Selectors

CSS offers a wide array of selectors to target elements on a webpage. “You can target things by ID, which are individual unique elements on a page, or they should be at least.

You could target things by data attributes. You could target things by children. So you could say the first child or the nth child or even the last child of some kind of parent situation with HTML.”

This versatility allows developers to style elements precisely and efficiently.

The Beauty of SASS

SASS (Syntactically Awesome Stylesheets) is an extension of CSS that offers advanced features like variables, nested rules, and mixins.

“SASS is another language on top of CSS that processes the CSS. You’re able to do variables now in CSS. I think nesting is coming and stuff. But in SASS, you’re able to do that right now.”

Here’s an example of using a variable in SASS:

$brand-color: #3498db;

body {
  color: $brand-color;
}

Practical CSS Tips and Tricks

Using CSS effectively can greatly enhance a website’s design and user experience. “CSS is really amazing. It’s adaptable. There’s so much more to it.” Here are a few tips:

  1. Use Variables for Consistency:
   :root {
     --main-color: #3498db;
   }

   body {
     color: var(--main-color);
   }

“You’re saying our brand color is blue, and I don’t want to write this blue every time. Maybe this is a certain hex code or something, so I’m able to use a variable.”

  1. Centering Elements:
   .center-me {
     display: flex;
     justify-content: center;
     align-items: center;
     height: 100vh;
   }

“Justify the content to center… It’s already centered.”

  1. Responsive Design with Media Queries:
   @media (max-width: 600px) {
     body {
       background-color: lightblue;
     }
   }

“Media queries are pretty much saying at a certain width or a certain height or anything… you’re pretty much saying at this certain width or on a phone or on a tablet, do this.”

Conclusion: Embrace the Power of CSS

CSS is an essential tool for anyone involved in web development. It transforms basic HTML into visually appealing and functional web pages. “CSS has really grown over the years, and it’s not going anywhere anytime soon.” Whether you’re a designer looking to bring your vision to life or a developer aiming to enhance your site’s usability, CSS is your go-to language.

Thanks for joining us on this early morning Sunrise Show. If you have any questions or need help with your web projects, feel free to reach out. Happy coding, and remember, a little bit of CSS can go a long way!


Posted on

Categories:

Tags: