DEV Community

Beey
Beey

Posted on

What is a CSS class definer and linking CSS to HTML(CSS basics 2/60)

What is a CSS class definer

A css class definer(or a css class specifier) allows you to group elements into one style by using the way to apply styles with the name of the class(class name).

CSS class naming conventions

CSS class naming conventions often include using kebab-case(all lowercase) and replacing spaces with hyphens for readability.

CSS readability tips

You can find CSS readability tips at WCAG(Resources On Digital Acessibility Standards): WCAG.com

CSS class definer syntax

The syntax for a class definer(You can add more propertys/styles) is:


.class-name {
  property: value;
}

Enter fullscreen mode Exit fullscreen mode

The '.' specifies it defines a CSS class.


How to link your CSS to HTML

Now in order for your CSS to work you need to link it in HTML in the <head> section.

Inside the <head> section, you will have to type <link rel="stylesheet" href="path-to-css-file.css">.

Replace path-to-css-file with your css file(dont forget to suffix it with .css).

Top comments (0)