cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!--

Related blog post
https://thetechremix.com/2017/11/21/animated-images-using-pure-html-and-css/

-->
<style>
    #frame {
        width: 600px;
        height: 400px;
        border: 1px solid grey;
        position: relative;
        background-color: transparent;
    }

    #pole {
        height: 340px;
        border-left: 21px solid darkgray;
        position: absolute;
        bottom: 0;
        left: 25px;
    }

    #flag {
        background-color: red;
        width: 196px;
        height: 120px;
        position: absolute;
        bottom: 50px;
        left: 45px;
    }

    #flag_diagonal {
        width: 240px;
        height: 30px;
        border-bottom: 5px solid white;
        border-top: 5px solid white;
        background-color: black;
        -webkit-transform: translateY(0px) translateX(0px) rotate(42deg);
        position: absolute;
        bottom: 92px;
        left: 21px;
    }

    #flag_top {
        background-color: white;
        width: 196px;
        height: 50px;
        position: absolute;
        bottom: 170px;
        left: 25px;
    }

    #flag_bottom {
        background-color: white;
        width: 220px;
        height: 50px;
        position: absolute;
        bottom: 0px;
        left: 45px;
    }

    @keyframes move_flag {
        from {
            bottom: 20px;
        }
        25% {
            bottom: 150px;
        }
        75% {
            bottom: 150px;
        }
        to {
            bottom: 20px;
        }
    }

    #flag_container {
        animation: move_flag 30s;
        position: absolute;
        bottom: 20px;
    }

    @keyframes move_sun {
        from {
            top: 420px;
        }
        25% {
            top: 420px;
        }
        50% {
            top: 30px;
        }
        75% {
            top: 420px;
        }
        to {
            top: 420px;
        }
    }

    #sun {
        animation: move_sun 30s;
        background-color: yellow;
        width: 100px;
        height: 100px;
        border-radius: 50%;
        position: absolute;
        top: 420px;
        left: 400px;
    }

    #frame_bottom {
        width: 600px;
        height: 120px;
        background-color: white;
        position: relative;
    }

    #mountain1 {
        width: 0;
        height: 0;
        border-left: 50px solid transparent;
        border-right: 50px solid transparent;
        border-bottom: 100px solid brown;
        position: absolute;
        bottom: 0px;
        left: 400px;
    }

    #mountain2 {
        width: 0;
        height: 0;
        border-left: 80px solid transparent;
        border-right: 50px solid transparent;
        border-bottom: 130px solid brown;
        position: absolute;
        bottom: 0px;
        left: 440px;
    }

    #mountain3 {
        width: 0;
        height: 0;
        border-left: 70px solid transparent;
        border-right: 50px solid transparent;
        border-bottom: 120px solid brown;
        position: absolute;
        bottom: 0px;
        left: 480px;
    }
</style>
<br/>
<div id="sun"></div>
<div id="frame">
    <div id="mountain1"></div>
    <div id="mountain2"></div>
    <div id="mountain3"></div>
    <div id="flag_container">
        <div id="flag"></div>
        <div id="flag_diagonal"></div>
        <div id="flag_top"></div>
        <div id="flag_bottom"></div>
    </div>
    <div id="pole"></div>
</div>
<div id="frame_bottom"></div>
            
          
!
999px
Loading ..................

Console