Home > Article > Web Front-end > How to clear inline css styles
How to clear inline css styles: first open the css project and view some of the inline css styles it contains; then open the editor; then use "style=\"(.*?)\"" regular expression The formula matches all embedded styles; finally, use the replacement tool to replace all content.
The operating environment of this tutorial: Windows 7 system, Sublime Text3&&css3 version, DELL G3 computer.
Recommendation: css video tutorial
Embedded css style
Embedded by writing CSS in the web page source The head of the file, that is, between 93f0f5c25f18dab9d176bd4f6de5d30e and 93f0f5c25f18dab9d176bd4f6de5d30e, is surrounded by the c9ccee2e6ea535a969eb3f532ad9fe89 tag in the HTML tag. Its characteristic is that this style can only be used on this page, which solves the problem of multiple inline styles. Disadvantages of sub-writing.
<style type="text/css"> p{ text-align: left; /*文本左对齐*/ font-size: 18px; /*字体大小 18 像素*/ line-height: 25px; /*行高 25 像素*/ text-indent: 2em; /*首行缩进2个文字大小空间*/ width: 500px; /*段落宽度 500 像素*/ margin: 0 auto; /*浏览器下居中*/ margin-bottom: 20px; /*段落下边距 20 像素*/ } </style>
How to clear inline css styles?
Use regular expressions to clear inline styles
Many times some projects contain some inline css styles, and manual deletion is a waste of time. How to delete inline styles in batches? PS: An editor that supports regular expression matching search is required.
style=\"(.*?)\" //匹配所有内嵌的样式
Then use the replace tool in the editor to replace all the content and it will be cleared.
The above is the detailed content of How to clear inline css styles. For more information, please follow other related articles on the PHP Chinese website!