Solution 1 :

You can have as many classes as you want, and they will show as long as there’s a corresponding CSS declaration for it. If there isn’t one, you can still assign class to the HTML

.square {
  width: 120px;
  height: 120px;

.blue {
  color: blue;

.red {
  background-color: red;

.bordered {
  border: solid black 3px;

.round {
  border-radius: 10px;
<div class="square blue red bordered round this-class-is-not-here">Hello there </div>

Problem :

Good morning. I am starting with HTML but I did not find why we can use a few class names in one element like at this screenshot. Here’s 3 class names in one element


Comment posted by JamesS

What? They’re just classes that define what that tag/ div looks like. You can, I believe, have as many as you want. In fact, you can even add classes that don’t even exist in there

Comment posted by Dejan.S

If you are reffering to why we can only add one id but more classes, it’s because ids are supposed to be unique, classes are for styling and hence you can have as many as you like.