Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- 에러왕
- AWS인스턴스에러
- 깃허브클론
- nextjs에러
- docker
- chatbotwithdatabase
- dockererror
- github
- 자바스크립트오버라이딩
- css밑줄
- 챗봇데이터베이스
- 자바스크립트공부
- Kubernetes
- 챗봇만들기
- 자스공부
- css
- css취소선
- JavaScript
- AWS에러
- chatbot
- css선없애기
- 자바스크립트
- 연결성 검사 실패 오류
- nextjserror
- cssfontsize
- 도커
- 도커버전
- AWS
- 링크선없애기
- 쿠버넨티스오류
Archives
- Today
- Total
에러왕
React/Next.JS peer for typing effect (타이핑효과를 줄때) 본문
Styleing based on sibling state(peer-{modifier})
When you need to style an element based on the state of sibling element, mark the sibling with the 'peer' class,
and use 'peer-*' modifiers like 'peer-invalid' to style the target element:
<div className="relative">
<input
id="email"
className="
block
rounded-md
px-6
pt-6
pb-1
w-full
text-md
text-white
bg-neutral-700
appearance-none
focus:outline-none
focus:outline-none
focus:ring-0
peer
"
// Styling based on sibling state(peer-{modifier})
placeholder=" "
/>
<label
className ="
absolute
text-md //to match the text
text-zinc-400
duration-150 //duration for transform
transform
-translate-y-3 //put it before class name
hover over-> I can see how that looks
scale-75
top-4
z-10 //Z index
origin-[0] //squre brackets
left-6
peer-placeholder-shown:scale-100
//it;s going to trigger on this spear placeholder shown. it's goot cuz I can modify this label element by interacting with this input element(위의코드)
//그래서 여기에다가 피어 더 쓸거임
peer-placeholder-shown:translate-y-0
peer-focus:sacale-75
peer-focus:-translate-y-3
"
htmlFor="email">
</label>
</div>
peer-placeholder-shown
peer는 주어진 형제요소를 선택함
예를들어 입력필드가 포커스를 받았을때 라벨을 위로 이동시키는것과 같은것!
즉 'peer-placeholder-shown' 은 입력필드의 플레이스 홀더가 표시되는 상태의 가상클래스선택지임
따라서 플레이스홀더가 보여지는경우와 보여지지 않는 경우 서로 다른 스타일 적용할수있는거임!!
translate-y , scale -> 라벨을 위로 이동시키고 축소하는 애니메이션 효과
'React Typescript Next.JS' 카테고리의 다른 글
| [NextJS]Fast refresh had to perform a full reload 에러 (0) | 2023.10.26 |
|---|