Home >Web Front-end >CSS Tutorial >Why should you try not to use css inline styles?
css inline style writes the style attributes directly in the style attribute of the start tag. It is difficult for multiple elements to share styles, which is not conducive to code reuse; and the HTML and CSS codes are mixed, and the structural styles are not separated, which is not conducive to the program. It is difficult for readers and search engines to read, which is not conducive to later maintenance.
The operating environment of this tutorial: Windows 7 system, css3 version, Dell G3 computer.
Recommended: css video tutorial
css inline style
Write the style attribute directly in the style attribute of the start tag
<div style="属性名称:属性值;属性名称:属性值;"></div>
Disadvantages:
Note:
For developers, The separation of style and html helps to change a new style later (it can also be said to be a new theme, many UI frameworks directly switch themes)
For the browser, Since the style file is a separate file, a cache can be created locally, which is beneficial to speeding up access to web pages.
For the server, if the style file browser reduces loading, the server can reduce download traffic and save server bandwidth.
Although these things are insignificant to a user, when the order of magnitude reaches a certain level, the traffic of one byte is very important, so try not to use css inline styles. .
For more programming-related knowledge, please visit: Programming Teaching! !
The above is the detailed content of Why should you try not to use css inline styles?. For more information, please follow other related articles on the PHP Chinese website!