Home >Web Front-end >HTML Tutorial >When writing CSS, will too many class levels affect the rendering performance of the page? _html/css_WEB-ITnose
Just give an example, such as:
<div class='first'> <div class='first-one'> <div class='first-two'> <span class="first-span"> test <small>small</small> </span> </div> </div></div>
For the front end, CSS focuses on code simplicity and shortening it as much as possible. If the code is too long, it will definitely affect the loading speed.
Generally speaking, when writing styles, it is best not to have more than 3 levels, as long as you can find the corresponding tag to set the style.
In addition, there are too many nested levels , too poor readability for other people
Theoretical impact. But it can be ignored. It's so long to write mainly because it looks awkward.
Basically this will not happen!
The important thing is to consider readability!
There will be performance issues. But a small amount of use will not have any impact
CSS is not difficult, but it is still not easy to write well. In order to facilitate reading and maintenance, there is also a logical relationship between the page structure , needs a good definition