Before2 CSS ::before ::before는 css를 통해 html 구조는 변경하지 않고 디자인을 추가함과 동시에 text도 쓸 수 있는 기능을 제공한다. 선택한 태그의 시작부분에 새로운 가상의 요소가 생긴다고 보면 된다. 단, content 속성은 꼭 넣어주어야 한다. 다음은 mdn의 before 설명이다. In CSS, ::before creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default. p::before{ content: 'hi '; } bob 위와 같은 cs.. 2020. 5. 18. CSS animation by before 박스를 색칠하는 애니메이션을 만들려면 어떻게 해야할까? 답은 ::before를 활용하여 구현한다. 핵심 아이디어는 다음과 같다. before와 색칠할 박스의 width, heigth를 동일하게 설정 position: absolute 사용하여 layer를 위로 이동 초기 width는 0으로 해두고 호버시 100%로 변경 색칠할 때 왼쪽에서 부터 오른쪽까지 채워지는 형태를 생각해볼 수 있다. 예시 코드) a:before{ width:0; height:100%: display:block; position:absolute; content:''; background-color: black; transition: all 1s; } a:hover:before{width:100%} 2020. 5. 15. 이전 1 다음