How to use ccs styles correctly
Once upon a time, when the first websites were born, resources looked quite simple, you could see only plain text on them. Gradually, the sites acquired a more elegant look, new software capabilities appeared. A technology was developed for the design of web pages - Cascading Style Sheets (CSS) .
During its existence, this technology has come a rather long way of development, some features were added, some were removed. Currently latest version is 3 . A large number of innovations have been added to it, which takes the site design to a completely different level.
Beginner developers use styles incorrectly. For example, instead of putting all the styles into one file and then connecting it to the page, they simply prescribe the necessary styles for each tag. This approach is wrong, because there is mixing of html code with css . If you suddenly need to change the design of an element, you will have to search for it for a long time among the tags. It will also negatively affect website promotion.
Another not entirely correct approach is to place the source code of the styles at the top of the page, in style tags . This method is used mainly on sites where fast page loading is extremely important, for example, on Google. Again, this is mixing html and css .
When developing, it is important to remember that not all css properties can be supported by all browsers, so it is worth referring to the documentation and looking at the compatibility tables of a particular property. For some properties, there are special analogues for a specific browser. This style should only be used in critical situations that cannot be avoided.
It is worth remembering that a large number of files included on the page noticeably slows down the website loading speed . Therefore, it is important to keep the number of such files to a minimum; it is best to minify all code and place it in one file. This feature is available in most modern CMS. For example, in Drupal it is done in the settings in a couple of clicks. All files are simply glued together and only one css file is connected to the page.
Thus, it is worth using cascading style sheets correctly, this is one of the factors for the successful development of any resource.
- 09.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes
- 07.07.22IT / Safety How to protect PHP, JS, HTML, CSS source code - obfuscation, minification, compression and encryption
- 06.07.22IT / Safety Connection not secure, problem with Lets Encrypt - how to fix expired 09/30/2021 DST Root CA X3, remove it manually and install ISRG Root X1. Example on MS Windows 7
- 08.07.21IT / Misc How to make a free translation for a website without an API, translate documents in Google Translate
- 06.07.21IT / Misc How to make a subscription button on a website, a subscriber base and automatic mailing