Tailwind css alert with icons on left
Web2tailwind.com

Output

Code

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js"></script>
    <link href="https://unpkg.com/[email protected]^1.0/dist/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto:[email protected];500&display=swap" rel="stylesheet">
</head> 

<body class="bg-gray-300" style="font-family:Roboto">
    <div class="flex justify-center items-center h-screen md:-mx-4">
    <div class="w-3/4">
      <div x-data="{show:true}" x-show="show" class="bg-white my-2 rounded-r-md px-6 border-l-4 -ml-4 border-blue-500">
        <div class="flex items-center py-4">
            <i class="fas fa-info-circle fill-current text-4xl text-gray-700"></i>
            <div class="flex-1 ml-5">
               <h1 class="font-bold">Well done!</h1>
               <p class="text-gray-700">You successfully read this important alert message.</p>
            </div>
            <div>
                <button @click="show=false" type="button" class=" text-yellow-700">
                    <span class="text-2xl">×</span>
                </button>
            </div>
        </div>
      </div>
      <div x-data="{show:true}" x-show="show" class="bg-white my-2 rounded-r-md px-6 border-l-4 -ml-4 border-gray-100 bg-green-500">
        <div class="flex items-center py-4">
            <i class="fas fa-check border-2 border-gray-200 px-2 rounded-full fill-current text-4xl font-light text-gray-200"></i>
            <div class="flex-1 ml-5">
               <h1 class="font-bold text-gray-200">Well done!</h1>
               <p class="text-gray-300">You successfully read this important alert message.</p>
            </div>
            <div>
                <button @click="show=false" type="button" class=" text-yellow-100">
                    <span class="text-2xl">×</span>
                </button>
            </div>
        </div>
      </div>
      <div x-data="{show:true}" x-show="show" class="bg-white my-2 rounded-r-md px-6 border-l-4 -ml-4 border-gray-100 bg-yellow-400">
        <div class="flex items-center py-4">
            <i class="fas fa-exclamation-circle rounded-full fill-current text-4xl text-gray-800"></i>
            <div class="flex-1 ml-5">
               <h1 class="font-bold text-gray-800">Warning !!!</h1>
               <p class="text-gray-800">Warning! Better check yourself, you're not looking too good.</p>
            </div>
            <div>
                <button @click="show=false" type="button" class=" text-yellow-100">
                    <span class="text-2xl text-gray-800">×</span>
                </button>
            </div>
        </div>
      </div>
    </div>
  </div>
</body>

</html>
© 2019 - 2020 Web2tailwind.com