DEV Community

Chris Pangilinan
Chris Pangilinan

Posted on

Learning CSS Basics #Part 1

Today I studied the basics of CSS or Cascading Style Sheets and what CSS does in web development. CSS is used to style web pages and make them look better. With CSS, we can change colors, fonts, sizes, and the layout of elements on a page. It helps separate the design from the content, which makes the code cleaner and easier to manage.

One of the first things I learned was CSS selectors. Selectors are used to choose which HTML element you want to style. For example, to style a paragraph:

p {
  color: blue;
}
Enter fullscreen mode Exit fullscreen mode

I also learned about properties and values. A property is what you want to change, and the value is how you change it. For example, changing font size:

h1 {
  font-size: 32px;
}
Enter fullscreen mode Exit fullscreen mode

I learned about fonts and text styling too. CSS allows us to change how text looks:

p {
  font-family: Arial, sans-serif;
  text-align: center;
}
Enter fullscreen mode Exit fullscreen mode

Spacing was another important lesson. I learned about margin and padding, which help control space around elements:

div {
  margin: 20px;
  padding: 10px;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)