Sei sulla pagina 1di 1

LightBox

g
How much British sign language do you know?

Create a flashing cursor


typed text effect
Introducing content headlines, presented with animation that simulates the use of realtime typing

1. HTML document step in this file initiates the colours to use in the animation:
Initiate the project by defining the HTML document body section. In this case, the background is set to typingEffect 3s steps(50),
structure. This consists a description for the HTML black and the content colour is set to white. blinkEffect .5s step-end infinite;
container, which stores the head and body sections. }
While the head section is used to link the external body{
CSS stylesheet file to the page, the body section will background: black; 6. Keyframes
store the visible content elements created in step 2. color: white; Animations are declared as a collection of keyframes,
} which provide the ability to specify the attributes for
<!DOCTYPE html> specific frames in the animation. The “typingEffect”
<html> 4. Typing: word setup animation applied in step 5 uses the width property in the
<head> The typing effect will rely on the content only being start and end frames. Using the settings in step 5, the
<title>Typing Effect</title> made visible as the content element is resized. To browser will automatically calculate the changes between
<link rel=”stylesheet” type=”text/css” achieve this, overflow is required to be set to hidden the start and end frame. The 50 steps from step 5 will
media=”screen” href=”styles.css”/> for avoiding visibility of unwanted content. White make the width change staggered for the typing effect.
</head> space must also be set as “nowrap” to avoid content
<body> appearing as words instead of individual letters. @keyframes typingEffect{
*** STEP 2 HERE from { width: 0 }
</body> .typing{ to { width: 100% }
</html> overflow: hidden; }
white-space: nowrap;
2. HTML content } 7. Animation: blinking
Content to be presented with the typing effect will The other animation applied in step 5 was for the
make use of a class called “typing”. This example 5. Typing: animation setup appearance of the blinking cursor. This animation sets 3
demonstrates how text using a h1 heading tag will Two parts are defined for the animation — the frames that change the border colour. While the first and
have the typing effect applied by using “typing” presentation of the content and the blinking cursor. Both last frame set the border colour to transparent, a middle
class. The CSS for the effect will be created to work of these are applied to by using animations created in frame at 50% of the animation sets the border colour to
with any type of element. steps 6 and 7. While the “typingEffect” animation is set to inherit colours set from a parent element. In this case,
occur over 3 seconds using 50 frames (steps), the colour is inherited from body styles set in step 3.
<h1 class=”typing”>All cows eat grass.</h1> “blinkEffect” will repeat infinitely. The blinking cursor is to
be made from the content element’s right side border. @keyframes blinkEffect{
3. CSS: colours from, to { border-color: transparent }
Create a new file called “styles.css” — the file linked to .typing{ 50% { border-color: inherit; }
the HTML document from its head section. The first border-right: .2em solid; }

lightbox________________________________________________ 27

Potrebbero piacerti anche