Карта наведения пу sh на верхний эффект - PullRequest
0 голосов
/ 13 февраля 2020

Привет, я пытаюсь сделать sh верх в моих текстах, и я использовал непрозрачность: 0, и когда он завис, я использую нижний отступ, но у меня есть проблема с этим, когда высота этого скрытого текста так как он будет продолжать занимать это пространство, потому что это не с дисплеем. Я не могу решить это:

enter image description here

но мне нужно мой текст должен быть в конце div, как это:

enter image description here

И это не начинается в конце моего div, потому что даже с непрозрачностью 0 мой текст все еще там

код:

 <TestingLive isHover={hoveredCards.card1}>
        <div
          className="a"
          onMouseOver={() => updateHoveredCards("card1", true)}
          onMouseOut={() => updateHoveredCards("card1", false)}
        >
          <div className="content-header">
            <p className="text-title">testing</p>
            <h3 className="content-text" style={{ color: "#fff" }}>
              testing
            </h3>
            <p className="date-text" style={{ color: "#fff" }}>
              <span>a</span>
              10 de dezembro de 2020
            </p>
            <p className="content-spoiler">
              show this text bottom on hover show this text bottom on hover show
              this text bottom on hover show this text bottom on hover
            </p>
          </div>
        </div>
      </TestingLive>

css:

const TestingLive = styled.div`
  display: grid;
  grid-template-areas:
    "a b c"
    "a d e";
  grid-gap: 4px;
  grid-template-columns: 40vw 1fr 1fr;
  height: 100%;
  max-height: 60vh;
  min-height: 60vh;
  padding: 0 20px;}
  & > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 20px;
    justify-content: flex-end;
    position: relative;
    -webkit-box-shadow: inset -200px -200px 5px 500px rgba(0, 0, 0, 0.32);
    -moz-box-shadow: inset -200px -200px 5px 500px rgba(0, 0, 0, 0.32);
    box-shadow: inset -200px -200px 5px 500px rgba(0, 0, 0, 0.32);
    background-position: center center;
    background-size: cover;
    border-radius: 5px;
    background-image: url("https://www.cronosolucoes.com.br/wp-content/uploads/2018/10/futuristic-technology-background-hd-overlay-115379004773cf6twdsmd.png");
    cursor: pointer;
  }

  & .a {
    grid-area: a;
  }
  & .content-header {
    transition: all 0.3s ease;
    ${({ isHover }) =>
      isHover &&
      `
    `}
  }
  & .content-spoiler {
    max-width: 300px;
    transition: all 0.3s ease;
    opacity: 0;
    color: white;
    display:none;
    ${({ isHover }) =>
      isHover &&
      `
    transition: all 0.3s ease;
    opacity:1;
    padding-bottom:20px;
    `}
    margin-top:10px;
  }
  & .text-title {
    border-radius: 5px;
    font-family: "Roboto", sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    display: inline-block;
    margin: 0 0 5px 0;
    padding: 3px 7px;
    line-height: 13px;
    pointer-events: auto;
    background-position: top center;
    background: linear-gradient(-45deg, #009ffd, #2a2a72);
    animation: ${HeaderKeyFrame} 5s ease infinite;
    background-size: 150% 100%;
    color: #fff;
  }
  & .content-text {
    max-width: 300px;
    text-align: left;
    font-size: 1.07692308rem !important;
    font-family: Roboto Slab, serif;
    font-weight: 400;
  }
  & .date-text {
    max-width: 250px;
    text-align: left;
    margin-top: 10px;
    font-size: 0.6692308rem !important;
    font-family: sans-serif, serif;
    letter-spacing: 0.1em;
    font-weight: 400;
    & > span {
      margin-right: 5px;
    }
  }
`;

пример:

https://codesandbox.io/s/great-snowflake-4dwpy

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...