All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

How Can We Write Comment Along With CSS Code

Last Updated : Mar 11, 2024

How Can We Write Comment Along With CSS Code

In this article we will show you the solution of how can we write comment along with css code, the Cascading style sheet or CSS is used to add style to the HTML.

To understand any source code later, we write comments along with the code.

Now when we write comments along with CSS code, the browser cannot show the statement.

As we previously know in HTML, we can write comments on any statement in any HTML file when we write a comment between <!-- and --!>.

Now in CSS, we can write comments between /* and */ .

Step By Step Guide On How Can We Write Comment Along With CSS Code :-

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> how can we write comment along with CSS code </title>
        /* add style to the heading */
         h1 {
         font-size: larger;
         font-weight: bolder;
         color: lightgreen;
        /* add background color
        height and width to the class container */
        .container {
            background-color: aquamarine;
            color: blue;
            font-weight: bolder;
            height: 500px;
            width: 400px;
    <h1> TALKERSCODE </h1>
    <p> how can we write comment along with CSS code </p>
    <div class="container">
       <!-- write a paragraph by the Emmet abbreviation -->
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem sint mollitia corporis facere. Nisi corrupti numquam delectus maiores hic amet veritatis odit. Recusandae, suscipit eos! Modi, eius beatae atque consequatur nulla repellat ut totam? Assumenda dolore voluptatum iusto facilis quasi. Minima eveniet dolor veritatis? Esse porro iste itaque fugiat error iusto similique hic? Illo, harum! Itaque quis fuga dolorum quam cum nesciunt laboriosam iusto aliquid magni, modi repellat dolores consequatur earum quos? Dicta voluptate, esse placeat officia itaque laboriosam nesciunt ducimus fugiat quasi libero laborum quam debitis exercitationem culpa iste, quaerat quidem aliquid? Voluptatibus fugiat, quae illo ea fuga dolor!
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now the <head> tag is used to contain information about the web page. In this tag, a <title> tag is used which helps us to specify a webpage title.
  4. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  5. Thirdly, the <body> tag is used to define the webpage body. All the contents to show on the website are written here.
  6. <h1> tag used to add heading here.
  7. Creating a <div> with a class “container”. writing a paragraph using the Emmet abbreviation into it and writing this statement as a comment between <!-- and --!> .
  8. Now create a <style> tag between the <head> tag to add CSS.
  9. Write a one line comment between /* and */ .
  10. Adding style to <h1> tag.
  11. Also Write a multiline comment between /* and */ .
  12. Adding style to the class “container”.

Conclusion :-

At last here in conclusion, here we can say that with the help of this article we are able to know how can we write comments along with CSS code.

I hope this article on how can we write comment along with css code helps you and the steps and method mentioned above are easy to follow and implement.

Author Image About Dikshita

Passionate Electronics and Communication Engineering student with expertise in web development (HTML, CSS, JS,PHP, Bootstrap, React.js) and content writing. Eager problem solver and tech enthusiast, adept at creating engaging web experiences.

Follow Dikshita On Linkedin 🡪