You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/1-document/08-styles-and-classes/article.md
+7-16Lines changed: 7 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,21 +128,16 @@ setTimeout(() => document.body.style.display = "", 1000); // 1초 후 다시 원
128
128
129
129
이렇게 `style.display`에 빈 문자열을 할당하면 브라우저는 마치 처음부터 `style.display` 프로퍼티가 없었던 것처럼 CSS 클래스와 브라우저 내장 스타일을 페이지에 적용합니다.
130
130
131
-
<<<<<<< HEAD
132
-
````smart header="`style.cssText`로 완전히 다시 쓰기"
133
-
개별 스타일 프로퍼티를 적용할 때는 보통 `style.*`를 사용합니다. 그런데 `div.style` 은 객체이고 읽기 전용이기 때문에 `div.style="color: red; width: 100px"`같은 방식으론 전체 스타일을 설정할 수 없습니다.
134
-
=======
135
-
Also there is a special method for that, `elem.style.removeProperty('style property')`. So, We can remove a property like this:
131
+
이를 위한 특별한 메서드인 `elem.style.removeProperty('style property')`도 있습니다. 아래와 같이 프로퍼티를 제거할 수 있습니다.
136
132
137
-
```js run
138
-
document.body.style.background='red'; //set background to red
133
+
````js run
134
+
document.body.style.background='red'; // 배경을 빨간색으로 설정
139
135
140
-
setTimeout(() =>document.body.style.removeProperty('background'), 1000); //remove background after 1 second
141
-
```
136
+
setTimeout(() =>document.body.style.removeProperty('background'), 1000); //1초 후 배경 제거
137
+
````
142
138
143
-
````smart header="Full rewrite with `style.cssText`"
144
-
Normally, we use `style.*` to assign individual style properties. We can't set the full style like `div.style="color: red; width: 100px"`, because `div.style` is an object, and it's read-only.
145
-
>>>>>>> upstream/master
139
+
````smart header="`style.cssText`로 완전히 다시 쓰기"
140
+
개별 스타일 프로퍼티를 적용할 때는 보통 `style.*`를 사용합니다. 그런데 `div.style` 은 객체이고 읽기 전용이기 때문에 `div.style="color: red; width: 100px"`같은 방식으론 전체 스타일을 설정할 수 없습니다.
146
141
147
142
문자열을 사용해 전체 스타일을 설정하려면 프로퍼티 `style.cssText`를 사용해야 합니다.
148
143
@@ -273,7 +268,6 @@ pseudo
273
268
````warn header="`getComputedStyle`엔 프로퍼티 전체 이름이 필요합니다."
274
269
`getComputedStyle`을 사용할 때는 `paddingLeft`, `marginTop`, `borderTopWidth`같이 프로퍼티 이름 전체를 정확히 알고 있어야 합니다. 그렇지 않으면 원하는 값을 얻을 수 없는 경우가 생깁니다.
275
270
276
-
<<<<<<< HEAD
277
271
`paddingLeft`나 `paddingTop`엔 값이 지정되어있는데 `getComputedStyle(elem).padding`을 사용해 값을 얻으려 하는 경우를 생각해 봅시다. 어떤 값을 얻을 수 있을까요? 아무것도 얻지 못할까요 아니면 값이 설정되어 있는 `paddingLeft`나 `paddingTop`에서 값을 가져올까요? 이런 상황에 적용할만한 표준은 아직 제정되어있지 않습니다.
278
272
279
273
따라서 브라우저마다 동작 방식이 다릅니다. Chrome 같은 몇몇 브라우저는 아래 예시와 같이 `10px`을 출력해주는데 Firefox에서 빈 문자열이 출력됩니다.
@@ -289,9 +283,6 @@ pseudo
289
283
alert(style.margin); // Firefox에선 빈 문자열이 출력됩니다.
290
284
</script>
291
285
```
292
-
=======
293
-
For instance, if there are properties `paddingLeft/paddingTop`, then what should we get for `getComputedStyle(elem).padding`? Nothing, or maybe a "generated" value from known paddings? There's no standard rule here.
Copy file name to clipboardExpand all lines: 2-ui/1-document/09-size-and-scroll/article.md
-8Lines changed: 0 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,11 +106,7 @@ CSS `position` 프로퍼티가 설정되어있는 조상 요소가 없는 경우
106
106
107
107
따라서 요소(혹은 이 요소의 조상 요소 중 어떤 것이든)의 CSS `display` 프로퍼티가 `none`이거나 문서 내에 해당 요소가 없으면 모든 기하 프로퍼티 값이 0이 됩니다(`offsetParent` 프로퍼티의 값은 `null`).
108
108
109
-
<<<<<<< HEAD
110
109
요소를 만들긴 했지만 아직 문서에 삽입하기 전이라던가, 새롭게 만든 요소의 `display` 프로퍼티가 `none`이면 기하 프로퍼티 값은 0, `offsetParent` 프로퍼티의 값은 `null`이 되는 것이죠.
111
-
=======
112
-
For example, `offsetParent` is `null`, and `offsetWidth`, `offsetHeight` are `0` when we created an element, but haven't inserted it into the document yet, or it (or its ancestor) has `display:none`.
113
-
>>>>>>> upstream/master
114
110
115
111
이런 특징을 이용하면 요소의 숨김 상태 여부를 아래 같은 방법으로 확인할 수 있습니다.
116
112
@@ -120,11 +116,7 @@ function isHidden(elem) {
120
116
}
121
117
```
122
118
123
-
<<<<<<< HEAD
124
119
참고로 `isHidden`은 요소가 화면에 있긴 하지만 사이즈가 0일 때(비어있는 `<div>` 등)도 `true`를 반환하기 때문에 주의해서 사용해야 합니다.
125
-
=======
126
-
Please note that such `isHidden` returns `true` for elements that are on-screen, but have zero sizes.
0 commit comments