Sunday, 15 February 2015

Master The Z-Index With The Purple Flower!

Master The Z-Index With The Purple Flower!
This purple flower might not be that spectacular but is a good example to explain the stack order of elements.

The stack order of elements is described by the CSS z-index property. An element with a higher value is shown in front of a lower valued element. Position properties (relative, absolute or fix) have to be assigned to elements in order to make the z-index work.

The flower is made of 3 parent elements with the following ids: purple_flower36, petal1 and petal5. The yellow center should be on top of the petals so we assign the highest z-index to it. By giving a lower z-index to the small petals (parent element is petal1) these are shown under the yellow dot. The big petals (parent element petal5) have the lowest z-index. The order of the child elements is also influencing the stack order. For example, petal3 is shown below petal4 although they have the same z-index 3 concluding the first element has a higher stack order than the second element.

Change the top/left value of #purple_flower36 and put the flower wherever you want!

HTML and CSS Code

Friday, 13 February 2015

Glowing Green Neon Sign With CSS Animation

Glowing Green Neon Sign With CSS Animation
Open
Glow effects always look cool! The text glows with CSS animation.
Different blurring levels created with the text-shadow property create the effect above. The animation property sets the value of length, frequency, style, timing of the animation. Look for details here. In this example, the glowing effect should go one forever so we set the value to infinite. @keyframes describes the details of the initial and final status of the animation with the following syntax:

@keframes animation name {
from{;}
to{;}
}

HTML and CSS Code

Tuesday, 10 February 2015

Glowing Tabs and Boxes with CSS Animation and JavaScript

Glowing Tabs and Boxes with CSS Animation and JavaScript
  • Cats
  • Dogs
  • Monkeys
"Miau, miau," says the cat.
"Wuff, wuff," barks the dog.
"I need some bananas," says the monkey.
Create some glowing tabs and boxes with CSS animation and JavaScript!

If you click one of the tabs shown above the related text box will fade in into the front of the screen. As described in the previous posts we use the CSS animation property. This time the animation should fire when a tab is clicked so we use the JavaScript onclick event and assign to each tab a different function. Clicking a tab applies a specific value to the CSS animation property invoking the glowing effect. The JavaScript syntax is as follows:

document.getElementById("ID of the tab").style.WebkitAnimation="value details";
document.getElementById("ID of the tab").style.animation="value details";


If one tab is glowing the rest should be transparent therefore the other animation properties have no value describing with "". The same time a tab is glowing its related text box should also visible which is done by setting the z-index to "2". The syntax is document.getElementById("the ID of the box").style.zIndex="2";

HTML, CSS and JavaScript Code

Sunday, 8 February 2015

Mouse With Moving Eyes With CSS Animation

Mouse With Moving Eyes With CSS Animation
Thinking about an animal easy to draw I came up with a mouse. A mouse is so easy: you just have to put several round shapes together, put dots in its face and here we have a mouse!

The head, the body, arms and legs, the mouth and eyes all parts are created with div elements. By using the CSS animation property you can move the eyes of the mouse. The left property values of the black dots with the id m_black_right_eye and m_black_left_eye are changed from 0px to 20px with the following syntax:

@keyframes eyemove {
from{left:0px;}
to{left:20px;}
}

The animation should go one forever so the value of the animation property is set to infinite.The black dots should go from left to right and vise versa with the value alternate.

Change the top and left value #mouse in the CSS code and position the mouse at will.

HTML and CSS Code

Monday, 2 February 2015

Dissolving Text With CSS Animation

Dissolving Text With CSS Animation
T
I
T
L
E

Click on the characters !

When you click on the text above it will dissolve.

This animation is created with JavaScript and the CSS animation property. We change the blur value of the text-shadow property from 0px to 50px creating the effect above. Here is the syntax:

@keyframes your animation{
from{text-shadow:0px 0px 0px;}
to{text-shadow:0px 0px 50px;}
}

The animation shouldn't start yet therefore this property doesn't contain anything at the beginning. To invoke the animation with the JavaScript onclick event we assign a certain value to it with the following syntax:

function function name(){
document.getElementById("ID of the element").style.WebkitAnimation ="details about the animation";
document.getElementById("ID of the element").style.animation="details about the animation";
}

Pretty easy, huh? Let`s start clicking on the text!

HTML and CSS Code

Sunday, 1 February 2015

Moving Title With CSS Animation

Moving Title With CSS Animation
T
I
T
L
E

The animation only works on your PC.
Reload the page if you want play the animation again.

You can create so many fantastic effects with the CSS animation property. In the example above, the alphabets are moving from the right to the left. Details of the animation property are explained here.

By changing the left property in @keyframes youranimation you can move the elements from the right to the left or vice versa. The value forwards means that it will apply the property values described in to{} after the animation is finished.

HTML and CSS Code