最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How do I apply the "outline" CSS property with JavaScript? - Stack Overflow

programmeradmin3浏览0评论

Typically, for styles that have to be applied dynamically to HTML objects with JS, we set it as an attribute using "setAttribute()"

What about this "outline" CSS property? How can I set that onto an object with JS? Unless there is a way to dynamically add CSS to the document?

Typically, for styles that have to be applied dynamically to HTML objects with JS, we set it as an attribute using "setAttribute()"

What about this "outline" CSS property? How can I set that onto an object with JS? Unless there is a way to dynamically add CSS to the document?

Share Improve this question asked Jun 7, 2009 at 5:51 Robin RodricksRobin Rodricks 114k147 gold badges414 silver badges617 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

You can change most CSS values using the following code:

document.getElementById('idofelement').style.outline='value';

or

object.style.cssproperty='value';

Here is what W3 has to say about it.

发布评论

评论列表(0)

  1. 暂无评论