Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>Get X and Y Position og Click Event</h1>
    <h2>Click On this Canvas</h2>
    <div id="box1">
        <label id="lbl1"></label>


    </div>
              
            
!

CSS

              
                
        .box {
            position: absolute;
            -moz-transition: 1s ease-in;
            -o-transition: 1s ease-in;
            -webkit-transition: 1s ease-in;
            transition: 1s ease-in;
            -moz-animation-name: boxAni;
            -o-animation-name: boxAni;
            -webkit-animation-name: boxAni;
            animation-name: boxAni;
            -moz-animation-delay: 0.5s;
            -o-animation-delay: 0.5s;
            -webkit-animation-delay: 0.5s;
            animation-delay: 0.5s;
            -moz-animation-duration: 3s;
            -o-animation-duration: 3s;
            -webkit-animation-duration: 3s;
            animation-duration: 3s;
            -moz-animation-iteration-count: infinite;
            -o-animation-iteration-count: infinite;
            -webkit-animation-iteration-count: infinite;
            animation-iteration-count: infinite;
            -moz-animation-play-state: running;
            -o-animation-play-state: running;
            -webkit-animation-play-state: running;
            animation-play-state: running;
        }

        @keyframes boxAni {
            0% {
                /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#a90329+0,ea383b+100&0+1,0.6+100 */
                background: -moz-radial-gradient(center, ellipse cover, rgba(169,3,41,0) 0%, rgba(170,4,41,0) 1%, rgba(234,56,59,0.6) 100%); /* FF3.6-15 */
                background: -webkit-radial-gradient(center, ellipse cover, rgba(169,3,41,0) 0%,rgba(170,4,41,0) 1%,rgba(234,56,59,0.6) 100%); /* Chrome10-25,Safari5.1-6 */
                background: radial-gradient(ellipse at center, rgba(169,3,41,0) 0%,rgba(170,4,41,0) 1%,rgba(234,56,59,0.6) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00a90329', endColorstr='#99ea383b',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
                bottom: 0;
                top: auto;
            }

            50% {
                bottom: 50%;
                top: auto;
            }


            100% {
                /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#fefcea+0,f1da36+100&0+0,0.6+100;Gold+3D */
                background: -moz-radial-gradient(center, ellipse cover, rgba(254,252,234,0) 0%, rgba(241,218,54,0.6) 100%); /* FF3.6-15 */
                background: -webkit-radial-gradient(center, ellipse cover, rgba(254,252,234,0) 0%,rgba(241,218,54,0.6) 100%); /* Chrome10-25,Safari5.1-6 */
                background: radial-gradient(ellipse at center, rgba(254,252,234,0) 0%,rgba(241,218,54,0.6) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00fefcea', endColorstr='#99f1da36',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
                bottom: 100%;
                top: auto;
            }
        }

        @-moz-keyframes boxAni {
            0% {
                /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#a90329+0,ea383b+100&0+1,0.6+100 */
                background: -moz-radial-gradient(center, ellipse cover, rgba(169,3,41,0) 0%, rgba(170,4,41,0) 1%, rgba(234,56,59,0.6) 100%); /* FF3.6-15 */
                background: -webkit-radial-gradient(center, ellipse cover, rgba(169,3,41,0) 0%,rgba(170,4,41,0) 1%,rgba(234,56,59,0.6) 100%); /* Chrome10-25,Safari5.1-6 */
                background: radial-gradient(ellipse at center, rgba(169,3,41,0) 0%,rgba(170,4,41,0) 1%,rgba(234,56,59,0.6) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00a90329', endColorstr='#99ea383b',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
                bottom: 0;
                top: auto;
            }

            50% {
                bottom: 50%;
                top: auto;
            }


            100% {
                /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#fefcea+0,f1da36+100&0+0,0.6+100;Gold+3D */
                background: -moz-radial-gradient(center, ellipse cover, rgba(254,252,234,0) 0%, rgba(241,218,54,0.6) 100%); /* FF3.6-15 */
                background: -webkit-radial-gradient(center, ellipse cover, rgba(254,252,234,0) 0%,rgba(241,218,54,0.6) 100%); /* Chrome10-25,Safari5.1-6 */
                background: radial-gradient(ellipse at center, rgba(254,252,234,0) 0%,rgba(241,218,54,0.6) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00fefcea', endColorstr='#99f1da36',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
                bottom: 100%;
                top: auto;
            }
        }

        @-webkit-keyframes boxAni {
            0% {
                /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#a90329+0,ea383b+100&0+1,0.6+100 */
                background: -moz-radial-gradient(center, ellipse cover, rgba(169,3,41,0) 0%, rgba(170,4,41,0) 1%, rgba(234,56,59,0.6) 100%); /* FF3.6-15 */
                background: -webkit-radial-gradient(center, ellipse cover, rgba(169,3,41,0) 0%,rgba(170,4,41,0) 1%,rgba(234,56,59,0.6) 100%); /* Chrome10-25,Safari5.1-6 */
                background: radial-gradient(ellipse at center, rgba(169,3,41,0) 0%,rgba(170,4,41,0) 1%,rgba(234,56,59,0.6) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00a90329', endColorstr='#99ea383b',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
                bottom: 0;
                top: auto;
            }

            50% {
                bottom: 50%;
                top: auto;
            }


            100% {
                /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#fefcea+0,f1da36+100&0+0,0.6+100;Gold+3D */
                background: -moz-radial-gradient(center, ellipse cover, rgba(254,252,234,0) 0%, rgba(241,218,54,0.6) 100%); /* FF3.6-15 */
                background: -webkit-radial-gradient(center, ellipse cover, rgba(254,252,234,0) 0%,rgba(241,218,54,0.6) 100%); /* Chrome10-25,Safari5.1-6 */
                background: radial-gradient(ellipse at center, rgba(254,252,234,0) 0%,rgba(241,218,54,0.6) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00fefcea', endColorstr='#99f1da36',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
                bottom: 100%;
                top: auto;
            }
        }

        .bubble {
            display: inline-block;
            width: 30px;
            height: 30px;
            border: 1px solid #F6F4F4;
            border-radius: 50%;
            box-shadow: 0px 0px 19px #eee;
            /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,7db9e8+100&0+0,0.5+100 */
            background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,0) 0%, rgba(125,185,232,0.5) 100%); /* FF3.6-15 */
            background: -webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,0) 0%,rgba(125,185,232,0.5) 100%); /* Chrome10-25,Safari5.1-6 */
            background: radial-gradient(ellipse at center, rgba(255,255,255,0) 0%,rgba(125,185,232,0.5) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#807db9e8',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
        }

        #box1 {
            height: 500px;
            width: 100%;
            border: 1px solid #000;
            box-shadow:inset 0 0 100px #eee;
        }
    
              
            
!

JS

              
                 document.getElementById("box1").addEventListener("click", function (event) {
            var l1 = document.getElementById("lbl1");
            var xC = event.clientX;
            var yC = event.clientY;

            l1.innerHTML = "X  :" + event.clientX + "<br>Y : " + event.clientY + "<br>";


            var b1 = document.createElement("span");
            b1.className = "bubble box";
            var xPosition = event.clientX - (b1.clientWidth);
            var yPosition = event.clientY - (b1.clientHeight);
            b1.style.left = xPosition + "px";
            b1.style.top = yPosition + "px";
            document.getElementById("box1").appendChild(b1);


        });

              
            
!
999px

Console