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.

CSS writing Conventions - Rules for instructions | Learn CSS | 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 Mar 15, 2024, from
https://disenowebakus.net/en/rules-instructions-css

Participates!

Share it with your friends in Social Networks!

Professor at the University of Guadalajara

Hugo Delgado Desarrollador y Diseñador Web en Puerto Vallarta

Professional in Web Development and SEO Positioning for more than 10 continuous years.
We have more than 200 certificates and recognitions in the Academic and Professional trajectory, including diploma certificates certified by Google.

CONTINUE LEARNING

IT ALSO DESERVES TO PAY TO VISIT:

Not finding what you need?

Use our internal search to discover more information
Related content:

Would you like to learn more about Web Design?

Meet all the courses and tutorials that we have for you completely free
Learn Web Design
 

Leave your Comment

SPONSOR

Your business can also appear here. More information

Your browser has blocked advertising.
Please 🙏 allow to visualize the announcements to be able to access, thank you.