In Web Development (CSS) Where do you add comments to your code and can you give examples of why and where?

Comments or annotations in code are usually posted to make it clear to yourself or others who have to work with that code what it is. What some people say is “My code explains itself” or words of equal intent never go up.

Suppose you have a piece of CSS formatting code that is meant for a particular section of your page.Then you do not place a comment on every line unless your client would explicitly ask this, but post a comment above or naaast the line where you start with that code, if it is a lot of code it can also be useful to write in a comment where the end is… Comments are intended to better describe the code and make it easier for the person who would need to change this code later without having to make more effort if necessary. I wrote comments here in Dutch, when people who do not master the Dutch language should be able to read the comments, then it is better to write them in English.

Examples of possible comments can be found in the code block below:

HTML, body\n {\ n text-align: center; \n width: 100%; \n margin: 0 auto; \n padding: 0px; \n font-family: "Lucida Grande", Tahoma, Verdana, Arial, sans-serif; \nbackground: #D3D8E8;  /* * Fallback color as linear-gradient (not supported * */\n background: Linear-gradient (to bottom, #edeff5, #D3D8E8); \n background-repeat: no-repeat; \n    

* */\n}\n

Here above are some notes, comments in the code posted, what to tell something about why a certain value is given and that thereby content will be more visible and what to tell where code for a particular section starts etc

In CSS we write a comment like here below:

/* * This is a comment * */\n

Or as below:

/* This is a comment */\n

Use comments to make things clearer where necessary, but make sure the code remains clear and that the code will not essentially consist of comments that will not make the whole thing clearer… Not every rule needs explanations, but it is useful to know where something is to describe the different sections and the possible things that can give some ambiguity for someone who should be able to work with it.

If you know more about CSSl, visit World Wide Web Consortium (W3C) And on css Syntax Module Level 3 You can find a LOT more information about CSS, feel free to take a look.Genioomed site is written in English, your CSS code check for correctness can be on CSS validation Service and the validation site is partially available in Dutch.

I hope I have been somewhat helpful with this answer.

Leave a Reply