Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67527

How to limit the visibility of a text to a container?

$
0
0

How can we make a text that is only visible to a rectangle? (think of the rectangle like a container, the text is only visible when it is right in the rectangle)

Then I want to animate the text from bottom to above like this:

enter image description here

Then:

enter image description here

and finally:

enter image description here

Here is the animation code but I have no idea how can we limit the visibility of the text to a container:

Note: I only can use viewport units like vw and vh and absolute positions

html {
  overflow: hidden;
}

#Text {
  position: absolute;
  font-family: 'Open Sans', sans-serif;
  font-weight: bold;
  font-size: 7.5vw;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: 0vh;
  animation: rollUp 3s ease-out infinite;
  animation-fill-mode: forwards ;
}


@-webkit-keyframes rollUp {
  from {
    top: 150vh
  }
  to {
    top: 0vh
  }
}
<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="style.css"> </head><body><div ><p id="Text">Revealing Text</p></div></body></html>

Viewing all articles
Browse latest Browse all 67527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>