Global Attributes

contenteditable

contenteditable 전역 특성은 사용자가 요소를 편집할 수 있는지 나타내는 열거형 특성입니다. <blockquote contenteditable="true"> <p>Edit this content to...

· 1min read · 2 views

contenteditable 전역 특성은 사용자가 요소를 편집할 수 있는지 나타내는 열거형 특성입니다.

<blockquote contenteditable="true">
  <p>Edit this content to add your own quote</p>
</blockquote>

<cite contenteditable="true">-- Write your own name here</cite>
blockquote {
  background: #eee;
  border-radius: 5px;
  margin: 16px 0;
}

blockquote p {
  padding: 15px;
}

cite {
  margin: 16px 32px;
  font-weight: bold;
}

blockquote p::before {
  content: "\201C";
}

blockquote p::after {
  content: "\201D";
}

[contenteditable="true"] {
  caret-color: red;
}

가능한 값은 다음과 같습니다.

  • true 또는 빈 문자열은 요소가 편집 가능함을 나타냅니다.
  • false는 요소가 편집 불가능함을 나타냅니다.

값 없이, <label contenteditable>예제</label>처럼 사용할 경우 빈 문자열 값으로 간주합니다.

특성이 없거나, 값이 유효하지 않은 경우 부모 요소로부터 상속합니다. 즉, 부모 요소를 편집 가능한 경우 자신도 편집 가능합니다.

가능한 값에 truefalse가 있긴 하지만, contenteditable 특성은 불리언 특성이 아닌 열거형 특성입니다.

텍스트 삽입 시 표시되는 커서의 색은 CSS caret-color 특성으로 바꿀 수 있습니다.

같이 보기

  • 모든 전역 특성.
  • HTMLElement.contentEditable, HTMLElement.isContentEditable

Related Docs

Global Attributes

accesskey

accesskey 전역 특성은 현재 요소에 대한 키보드 단축키를 생성할 때 사용할 힌트를 제공합니다. accesskey 속성의 값은 반드시 출력 가능한 단일 문자(키보드로...

1min read 1 views
Global Attributes

autocapitalize

autocapitalize 전역 특성은 사용자가 입력하거나 수정하는 텍스트를 자동으로 대문자로 바꾸는 방식을 제어하는 열거형 특성입니다. 가능한 값은 다음과 같습니...

1min read 2 views
Global Attributes

autofocus

autofocus 전역 특성은 페이지 로드 시 또는 <dialog> 표시 시 해당 요소가 자동으로 포커스를 받아야 함을 나타내는 불리언 특성입니다. <input name="q" autof...

1min read 2 views
Global Attributes

class

class 전역 특성은 공백으로 구분한 요소 클래스의 목록으로, 대소문자를 구분하지 않습니다. 클래스는 CSS나 JavaScript에서 클래스 선택자나 DOM 메서드의 doc...

1min read 2 views

Comments (0)

No comments yet. Be the first to comment!

Leave a Comment

로그인 후 댓글을 남길 수 있습니다.