How Can We Write Comment Along With CSS Code
Last Updated : Mar 11, 2024
IN - CSS | Written & Updated By - Dikshita
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"> <head> <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> <style> /* add style to the heading */ h1 { font-size: larger; font-weight: bolder; color: lightgreen; } /* add background color color font-weight height and width to the class container */ .container { background-color: aquamarine; color: blue; font-weight: bolder; height: 500px; width: 400px; } </style> </head> <body> <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! </div> </body> </html>
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- 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.
- Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Thirdly, the <body> tag is used to define the webpage body. All the contents to show on the website are written here.
- <h1> tag used to add heading here.
- 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 --!> .
- Now create a <style> tag between the <head> tag to add CSS.
- Write a one line comment between /* and */ .
- Adding style to <h1> tag.
- Also Write a multiline comment between /* and */ .
- 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.