Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML & CSS best practices. #7

Open
NurkaAmre opened this issue Oct 10, 2022 · 0 comments
Open

HTML & CSS best practices. #7

NurkaAmre opened this issue Oct 10, 2022 · 0 comments

Comments

@NurkaAmre
Copy link
Owner

Use the appropriate tags for each element (e.g., links, titles, etc.) and use HTML5 semantic tags (e.g., header, nav) over divs. ✅

Avoid lines of code that are too long (100 characters or more). ✅

Be careful with blank lines and indentation. ✅

Do not add blank lines, spaces, or indentations without a reason. ❌ http://joxi.ru/82Qnn5lc8n7kEA
For readability, add blank lines to separate large or logical code blocks. ✅
For readability, add two spaces of indentation. Do not use the tab key. ✅
on some code editors, you can set the tab button to do an X amount of spaces.
Close all HTML elements. ✅

always needs
Use lowercase for elements and attribute names. ✅

use

not

use
not

Always quote attribute values.

use

not

Use space-less equal signs.

use

not

Do not use inline styles. Keep your style definition in a separate CSS file. ✅

Do not overuse !important rule in your CSS style definitions. ✅ I even dont know what is it!

Always use the class attribute for multiple elements (do not use ID selector for multiple elements). ✅

If you want to create a CSS rule for multiple elements, use a class attribute instead. For example, instead of using color: #3498db; 3 times ✅

#intro1 {color: #3498db; font-size: 10px; font-weight: bold;}
header {color: #3498db; font-size: 20px; background-color: green;}
#banner {color: #3498db; font-size: 30px; background-image: url(images/static.jpg);}

you can create a class and add it to all element that need to be blue.

.blue {color: #3498db;}
Do not commit old pieces of code as inline comments. They will make your project look messy. If you need to review a previous version of your code, you can always use git history. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant