aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/css/_colon_focus-within/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/css/_colon_focus-within/index.html')
-rw-r--r--files/ko/web/css/_colon_focus-within/index.html96
1 files changed, 96 insertions, 0 deletions
diff --git a/files/ko/web/css/_colon_focus-within/index.html b/files/ko/web/css/_colon_focus-within/index.html
new file mode 100644
index 0000000000..7a25dc5b94
--- /dev/null
+++ b/files/ko/web/css/_colon_focus-within/index.html
@@ -0,0 +1,96 @@
+---
+title: ':focus-within'
+slug: 'Web/CSS/:focus-within'
+tags:
+ - CSS
+ - Layout
+ - Pseudo-class
+ - Reference
+ - Selector
+ - Web
+translation_of: 'Web/CSS/:focus-within'
+---
+<div>{{CSSRef}}</div>
+
+<p><a href="/ko/docs/Web/CSS">CSS</a> <strong><code>:focus-within</code></strong> <a href="/ko/docs/Web/CSS/Pseudo-classes">의사 클래스</a>는 포커스를 받았거나, 포커스를 받은 요소를 포함하는 요소를 나타냅니다. 즉 스스로 {{CSSxRef(":focus")}} 의사 클래스와 일치하거나, 그 자손 중 하나가 <code>:focus</code>와 일치하는 요소를 나타냅니다. (<a href="/ko/docs/Web/Web_Components/Shadow_DOM">섀도 트리</a> 내부도 포함)</p>
+
+<pre class="brush: css no-line-numbers notranslate">/* Selects a &lt;div&gt; when one of its descendants is focused */
+div:focus-within {
+ background: cyan;
+}</pre>
+
+<p>흔히 쓸 수 있는 예시로서, {{HTMLElement("form")}}의 {{HTMLElement("input")}} 필드 중 하나가 포커스된 경우 전체 <code>&lt;form&gt;</code>을 강조해야 할 때 유용하게 사용할 수 있습니다.</p>
+
+<h2 id="구문">구문</h2>
+
+<pre class="syntaxbox notranslate">{{CSSSyntax}}</pre>
+
+<h2 id="예제">예제</h2>
+
+<p>다음 예제에서는 두 텍스트 입력 칸 중 하나라도 포커스를 받은 경우 양식을 강조합니다.</p>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html notranslate">&lt;p&gt;아래 양식의 값을 채워주세요.&lt;/p&gt;
+
+&lt;form&gt;
+ &lt;label for="given_name"&gt;이름:&lt;/label&gt;
+ &lt;input id="given_name" type="text"&gt;
+ &lt;br&gt;
+ &lt;label for="family_name"&gt;성:&lt;/label&gt;
+ &lt;input id="family_name" type="text"&gt;
+&lt;/form&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css highlight[7] notranslate">form {
+ border: 1px solid;
+ color: gray;
+ padding: 4px;
+}
+
+form:focus-within {
+ background: #ff8;
+ color: black;
+}
+
+input {
+ margin: 4px;
+}
+</pre>
+
+<h3 id="결과">결과</h3>
+
+<p>{{EmbedLiveSample("예제", 500, 150)}}</p>
+
+<h2 id="명세">명세</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("CSS4 Selectors", "#the-focus-within-pseudo", ":focus-within")}}</td>
+ <td>{{Spec2("CSS4 Selectors")}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="브라우저_호환성">브라우저 호환성</h2>
+
+
+
+<p>{{Compat("css.selectors.focus-within")}}</p>
+
+<h2 id="같이_보기">같이 보기</h2>
+
+<ul>
+ <li>{{CSSxRef(":focus")}}</li>
+ <li>{{CSSxRef(":focus-visible")}} {{Experimental_Inline}}</li>
+</ul>