8 Program to demonstrate Dynamic CSS in VueJS

Program:

index.html:

<!DOCTYPE html>

<html>



<body>

    <div id="ad">



        <div v-bind:class="{status:status}">

            Hwll

        </div>



        <button v-on:click="status=!status"> Click Here </button>



    </div>



    <div style="margin-top:500px;"></div>

    <link rel="stylesheet" type="text/css" href="./style.css">

    <script src="https://unpkg.com/vue"></script>

    <script type="text/javascript" src="./index.js"> </script>



</body>



</html>


style.css:

.status{

    color: red;

}



index.js:

var app = new Vue({

    el: '#ad',

    data: {

        status: false,

    },

    methods: {

    

    }

});



Output:

Dynamic CSS in VueJS







Previous
Next Post »