Creating a web site and HTML pages is easy, but there are some rules to follow. And as everywhere, there are habits to take and mistakes to avoid. Here is a list of errors that should be avoided.
For your website
- Simple names. No case, no caps, no special characters in filenames. For example: not "my image.jpg" but "my_image.jpg. This will save you a lot of link or code errors.
- Explicit names. For example "Car.jpg" or "computer.jpg" are simpler than "img_1.jpg" and "img_2.jpg. Not only is it good for you, for you there, but for Google and other search engines.
- Organize your site with folders and subfolders. This is a good advice. Have one folder with 40 images, 30 HTML files and 5 CSS files is not practical.
- Put an index.html file in each folder. When you access a folder, the index file will automatically load and the visitor can not see the contents of the folder itself. It is also very important when the records will be visible in Google for example.
- Know where you are going. When you start your pages, initially they will be in .html. If you want to add PHP,then it is needed to rename all the files. Php, will render the old links to the .html files invalid. It's stupid as you must rename all your files, so better use php at the begnning.
Test your pages with several browsers: there may be changes with the display and you will need to correct them.
For your HTML code
- Code readability. Use the comments and indentation. It's better for you but also for anyone who wants, for whatever reason, examine your source code.
- Use tags correctly: each HTML tag has its specificities. Why make a page using <div> when you can use
- Separate content and container. Use the HTML file in your text and a CSS file next to any design. It's easier to update and offers many advantages: a separate CSS file can be used for multiple HTML pages at once. A change of the CSS and the whole site is being affected. This is faster than changing each page one by one.
- Simplify your life instead of complicating it. The use of a CSS "class" and "id" to target a particular part of the document. It is you yourself who can choose the classes and id, then give their names as humanly comprehensible "menu" or "header".
- Follow the rules defined by the W3C. Your site will be standards-compliant and will be even more appreciated.