diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/ko/web/css/_colon_focus-within/index.html | |
parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip |
initial commit
Diffstat (limited to 'files/ko/web/css/_colon_focus-within/index.html')
-rw-r--r-- | files/ko/web/css/_colon_focus-within/index.html | 96 |
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 <div> when one of its descendants is focused */ +div:focus-within { + background: cyan; +}</pre> + +<p>흔히 쓸 수 있는 예시로서, {{HTMLElement("form")}}의 {{HTMLElement("input")}} 필드 중 하나가 포커스된 경우 전체 <code><form></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"><p>아래 양식의 값을 채워주세요.</p> + +<form> + <label for="given_name">이름:</label> + <input id="given_name" type="text"> + <br> + <label for="family_name">성:</label> + <input id="family_name" type="text"> +</form></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> |