CSS

[css] CSS - 구글 로그인 포커스 애니 효과 (Google Logn Foucs Animation Effect) ※ 다중 가상선택자 예제

 

 

<style>

body{

  font-family: sans-serif;

}


.input_group{

  position: relative;

  padding-top: 13px;

}


.input_group input{

  border: 1px solid lightgrey;

  border-radius: 5px;

  outline: none;

  min-width: 250px;

  padding: 15px 20px;

  font-size: 16px;

  transition: all .1s linear;

  -webkit-transition: all .1s linear;

  -moz-transition: all .1s linear;

  -webkit-appearance:none;

}


.input_group input:focus{

  border: 2px solid #3951b2;

}


.input_group input::placeholder{

  color:transparent;

}


.input_group label{

  pointer-events: none;

  position: absolute;

  top: calc(50% - 8px);

  left: 15px;

  transition: all .1s linear;

  -webkit-transition: all .1s linear;

  -moz-transition: all .1s linear;

  background-color: white;

  padding: 5px;

  box-sizing: border-box;

}


.input_group input:required:invalid + label{

  color: red;

}

.input_group input:focus:required:invalid{

  border: 2px solid red;

}

.input_group input:required:invalid + label:before{

  content: '*';

}

.input_group input:focus + label,

.input_group input:not(:placeholder-shown) + label{

  font-size: 13px;

  top: 0;

  color: #3951b2;

}

</style>


<div class="input_group">

  <input type="text" placeholder=" "/>

  <label>아이디</label>

</div>

<br/>

<div class="input_group">

  <input type="password" placeholder=" " required/>

  <label>비밀번호</label>

</div>

 

결과보기

tofanelli 님 https://codepen.io/tofanelli/pen/Ormgrz


방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
intro CSS - 정의・장점・구문・초기화 + 주석
intro CSS - 발전사 (CSS1 → CSS2.01 → CSS) + 제작관리 단체
intro CSS - 스타일 적용 방법 3가지 ★★★ - (인라인스타일 / 내부스타일 / 외부스타일) CSS적용순서 +…
selector CSS - 선택자 (Selector) 종류 + 선택자에 사용가능한 문자 (= 선택자 이름짓기 주의사항)
selector CSS - ID선택자, class선택자 + CSS우선순위 ★★★ (= 아이디선택자, 클래스선택자, CSS명시…
selector CSS - * 전체선택자 - 모든 요소 선택. (요소선택자군) ※ 아스테리크 (asterisk) 선택자 = …
selector CSS - element 요소선택자 ★ - 지정 요소 선택. (요소선택자군)
selector CSS - element,element 병렬선택자 ★ - 쉼표로 나열된 여러 요소 선택. (= 여러 요소선택…
selector CSS - element element 자손선택자 ★ - 자손요소 (요소선택자)
1/33
목록
 홈  PC버전 로그인 일본어
웹디자인언어 1
서버관리언어
고급코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 2
웹유틸
회원센터
홈짱 PC버전 로그인