Apply Directive

 USE @apply TO INLINE ANY EXISTING UTILITY CLASSES INTO YOUR OWN CUSTOM CSS.

WHENEVER WE HAVE REPEATED CLASS ELEMENTS , WE CAN GIVE THEM A COMMON CLASS NAME AND USE APPLY DIRECTIVE.


    <div class="bg-purple-500 text-white my-4 border-8 rounded border-green-600">
      one
    </div>
    <div class="bg-purple-500 text-white my-4 border-8 rounded border-blue-600">
      two
    </div>
    <div class="bg-purple-500 text-white my-4 border-8 rounded border-rose-600">
      three
    </div>



index.html

<div class="box border-green-600">
      one
    </div>
    <div class="box border-blue-600">
      two
    </div>
    <div class="box border-rose-600">
      three
    </div>

STYLE.CSS

.box{
    @apply bg-purple-500 text-white my-4 border-8 rounded;
}










Comments

Popular posts from this blog

Introduction

Break points in Tailwind

Color and Spacing