<分区>
<分区>
我看到这种情况越来越频繁地发生。
我总是被教导要将 html、css 和 javascript 分开(当然 html 链接到源/脚本)。
我有时理解如果you're sending an email然后在 html 中使用 style 属性
有时是可以的并且是首选。
但是,在构建网站或应用程序时,使用 style
属性是否被认为是不好的做法?
<div style="margin: 0 auto; width: 114px; height: 32px; text-align: center; font-family: arial; padding: 25px; border-radius: 50px; line-height: 32px; background: rgb(46, 154, 255);">Hello world</div>
最佳答案
是的,这是不好的做法。这里有几个原因:
style
属性,您现在必须复制并粘贴每个段落的样式。)!important
关键字。关于html - CSS 作为 HTML 属性是不好的做法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37370665/