使用的style属性皱眉了吗? [英] Is using the style attribute frowned upon?

查看:88
本文介绍了使用的style属性皱眉了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为一个开始从基于表格的设计过渡到完全CSS的人,我想知道是否使用style属性来调整元素被认为是作弊,并且如果绝对所有的演示文稿应该严格地在样式表中?

另请参阅:




风格问题 - 样式和样式表的方法



解决方案

在某些情况下,您肯定知道您要做的只是调整此特定元素的样式,其他。



在这些情况下,您可以愉快地使用内联样式属性。 但是,在未来的某个时候,您会意识到,实际上您需要将相同的样式应用于其他类型,并且您会发现自己错了。



在那里,完成了。 8 - )

As someone who is beginning to make a transition from table based design to full CSS I'm wondering if using the style attribute to make adjustments to elements is considered "cheating" and if absolutely ALL presentation should be strictly in the style sheet?

See also:

A question of style - approaches to styling and stylesheets

解决方案

There are cases where you know for sure that all you want to do is tweak the style of this one specific element, and nothing else.

In those cases you can happily use an inline style attribute. But then, at some point in the future, you'll realise that in fact you need to apply the same style to something else, and you'll realise you were wrong.

Been there, done that. 8-)

这篇关于使用的style属性皱眉了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆