blob: 5976dd66bc9eded0f44b9f171e53204e5ff1cc58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
---
title: element.style
slug: Web/API/HTMLElement/style
tags:
- API
- HTML DOM
- HTMLElement
- Property
- Reference
- Style
translation_of: Web/API/ElementCSSInlineStyle/style
---
<div>{{ APIRef("HTML DOM") }}</div>
<p><code><strong>HTMLElement.style</strong></code> 속성은 요소의 인라인 스타일에 접근하거나 설정할 때 사용할 수 있습니다. 접근자로서는 요소의 인라인 <a href="/ko/docs/Web/HTML/Global_attributes/style"><code>style</code> 속성</a>이 포함한 CSS 선언을 담은 {{domxref("CSSStyleDeclaration")}} 객체를 반환합니다</p>
<h2 id="예제">예제</h2>
<pre class="brush: js">// Set multiple styles in a single statement
elt.style.cssText = "color: blue; border: 1px solid black";
// Or
elt.setAttribute("style", "color:red; border: 1px solid blue;");
// Set specific style while leaving other inline style values untouched
elt.style.color = "blue";</pre>
<h2 id="명세">명세</h2>
<p><a href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle">DOM Level 2 Style: ElementCSSInlineStyle.style</a></p>
<p><a href="https://www.w3.org/TR/cssom-1/#the-elementcssinlinestyle-interface">CSSOM: ElementCSSInlineStyle</a></p>
<h2 id="브라우저_호환성">브라우저 호환성</h2>
<p>{{Compat("api.HTMLElement.style")}}</p>
<h2 id="같이_보기">같이 보기</h2>
<ul>
<li><a href="/ko/docs/DOM/Using_dynamic_styling_information" title="DOM/Using dynamic styling information">Using dynamic styling information</a></li>
</ul>
|