Giter Club home page Giter Club logo

Comments (1)

bluepebble25 avatar bluepebble25 commented on June 1, 2024

문제 해결 방법

position: absolute로 지정한 요소를 정 중앙에 위치시키는 법

  • absolute 요소의 상위 요소를 relative로 잘 감쌌다면, left: 50%, top: 50%을 줘서 가운데에 위치시킨다.
  • absolute 요소의 위치 기준은 맨 위 왼쪽 꼭짓점이므로, 자기 몸체의 절반만큼을 왼쪽과 위로 이동시키기 위해
    transform: translate(-50%, -50%)을 준다.

카드 영역에 마우스가 위치할 때 버튼이 보이게 하기

  • 마우스가 카드 위에 위치하는지 여부를 저장하는 state를 만든다.
  • onMouseOver 이벤트는 마우스가 요소 위에 위치할 때 계속 발생하므로, 들어올 때와 나갈때를 감지하는 onMouseEnteronMouseLeave 이벤트를 Card 요소에 준다.
  • onMouseEnter일 때는 카드 위에 마우스 위치하는지 여부를 setState를 이용해 true로, onMouseLeave에는 false로 설정한다.
  • 버튼 요소에 state가 true이면 display: block, false면 display: none을 준다.

from phoca-review.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.