CSS writing Conventions - Rules for instructions
CSS instructions must follow some rules when making use of: uppercase and lowercase letters, accents, hyphens , double or single quotes.
Writing conventions in CSS
CSS and HTML are not case sensitive in the names of elements and attributes , but in the values of the attributes.
There the difference between uppercase and lowercase affects the style instructions. Therefore, class = "redbold" and class = "RedBold" are two different classes.
To this we must add that not all browsers distinguish between uppercase, and that it is not a very good style to use in the same names sometimes uppercase and sometimes lowercase.
The names of selectors IDs and classes can only contain letters (az, AZ), numbers (0-9) and hyphen (-), but they must always start with a letter.
In theory, in the CSS instructions you can use an umlaut whenever it has been declared correctly, as well as other special characters. But the reality is that the strict syntactic rules of (X) HTML prevent it, for example when naming IDs.
It is also not advisable to use underline underscores (_) since these were not always included in the CSS specification, so some older browsers can not interpret them.
Another frequent source of error is the incorrect use of quotes. In HTML it is usual to write attribute values in quotes, for example:
<body bgcolor=”#ffffff”>
But in CSS that form of writing is not valid. The correct thing would be:
body {
background-color: #ffffff;
}
Only when a value contains a blank character should quotes be used in the style application in CSS, for example:
h1 {
font-family: ‘Times New Roman’, serif;
}
In principle, you can also use double quotes, but as some browsers find them irritating, you would normally use simple quotes.
ChatGPT Free
Ask questions on any topic
CITE ARTICLE
For homework, research, thesis, books, magazines, blogs or academic articles
APA Format Reference:
Delgado, Hugo. (2019).
CSS writing Conventions - Rules for instructions.
Retrieved Nov 04, 2024, from
https://disenowebakus.net/en/rules-instructions-css