Giter Site home page Giter Site logo

hs-html-css-todo's Introduction

##Getting Jiggy With It

Let's make a box dance with CSS animations!!

You'll want to open up index.html in the browser. You should see a red box on the screen.

You'll code your solution in style.css The CSS selector that we use is the most important part about animations.

###@keyframes We're going to use @keyframes rule which takes a custom animation name as an argument. @keyframes sets stages in a timeline for your animation in percentages.

In style.css, it should look something like this

@keyframes CUSTOM-NAME-FOR-ANIMATION{
  0% {}
  25%{}
  75%{}
  100%{}
}

###Vendor Prefixes It's important to remember vendor prefixes here. Not all animations are supported by every browser, and in order to make the animations work for every browser, you'll have to declare which browser you're using.

Chrome:

@-webkit-keyframes CUSTOM-NAME-FOR-ANIMATION{
}

Firefox:

@-moz-keyframes CUSTOM-NAME-FOR-ANIMATION{
}

Opera:

@-o-keyframes CUSTOM-NAME-FOR-ANIMATION{
}

###Dancing Rules You're going to want to change the width and height properties during your animation.

0% is the starting point, so you'll want your box to start at 100px wide and 100px tall.

25% you'll want your box to change to 300px tall and 100px wide

50% you'll want your box is change to 100px tall and 300px wide

75% you'll want to change your box to 500px tall and 100px wide

100% you'll want to set your box back to 100px tall and 100px wide

###Calling The Animation Now we actually need to call the animation. You'll want to add to the already written CSS for the id redbox. By using something like this:

  -webkit-animation: NAME-YOUR-ANIMATION 5s infinite; /* Safari 4+ */
  -moz-animation:    NAME-YOUR-ANIMATION 5s infinite; /* Fx 5+ */
  -o-animation:      NAME-YOUR-ANIMATION 5s infinite; /* Opera 12+ */
  animation:         NAME-YOUR-ANIMATION 5s infinite; /* IE 10+, Fx 29+ */

The 5s is the duration of one single animation in seconds. The infinite tells the animation to repeat in an infinite loop.

The animations should start as soon as your page loads without clicking anything or hovering over anything.

View Getting Jiggy With It on Learn.co and start learning to code for free.

hs-html-css-todo's People

Contributors

ahimmelstoss avatar fislabstest avatar fs-lms-test-bot avatar vanessadean avatar victhevenot avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.