How to add comment in CSS

🗓️ Updated: 17.08.2022
💬Comments: 0
👁️Views: 4760

How to properly add comment to code in CSS. Suppose you want to temporarily disable some styles, but do not want to delete the code. To do this, you can use a special code for commenting:

/* h1 {
  color: red;
  font-size: 32px;
} */

Or another example:

h1 {
/*   color: red;
  font-size: 32px; */
  text-align: center;
}

So we can comment the code with the opening symbols /* and closing symbols */.

And you can comment not only the code, but any text. For example:

/* Headings  */

h1 {
  color: red;
  font-size: 32px;
  text-align: center; /* align to the center of the block */
}

Was the article helpful?
👍
Yes - 8
👎
Not - 1
💬Comments:

CSS Головоломки в Telegram
Subscribe and don't miss:
Actual news
Interesting puzzles
Useful links
Our rating
🏆The best website hosting
9/10
8/10
8/10
4
8/10
8/10
7/10
7/10
Что читают?
🏆Популярные записи
How to make a burger menu – complete code and detailed explanation
Views: 56414
How to make a smooth zoom of the image on hover – effect on pure CSS
Views: 42572
Appearance of elements on scrolling
Views: 41858
How to center an image with CSS
Views: 25882
How to make a button click effect in CSS
Views: 19447
Check of knowledge
🤔How well do you know CSS?
Есть два блочных элемента, которые идут друг за другом в html. Какой будет оступ (margin) между ними, если задать им такие стили:

.top {
  height: 30px;
  background-color: blue;
  margin-bottom: 10px;
}
.bottom {
  height: 30px;
  background-color: red;
  margin-top: 20px;
}
    
10px
20px
30px
Viva Magenta
🤔Color of 2023
The Pantone Research Institute has chosen the color of the year for 2023. They became a carmine-red shade with a purple undertone, which was called Viva Magenta.
#bb2649