Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!-- title -->
<div class="p-24 bg-green-900 flex flex-col justify-center items-center">
   <h2 class="pb-10 font-bold text-6xl text-green-200 text-center">Alerts with Tailwind CSS</h2>
</div>

<!-- simple alerts -->
<div class="p-24 bg-green-500 flex flex-col justify-center items-center space-y-5">
   <h3 class="pb-10 font-bold text-4xl text-green-900 text-center">Simple Alerts</h3>
   <div class="w-full p-5 rounded-lg border border-blue-400 bg-blue-300 text-blue-900">Primary Alert</div>
   <div class="w-full p-5 rounded-lg border border-gray-500 bg-gray-400 text-gray-900">Secondary Alert</div>
   <div class="w-full p-5 rounded-lg border border-green-400 bg-green-300 text-green-900">Success Alert</div>
   <div class="w-full p-5 rounded-lg border border-red-400 bg-red-300 text-red-900">Danger Alert</div>
   <div class="w-full p-5 rounded-lg border border-yellow-400 bg-yellow-300 text-yellow-900">Warning Alert</div>
   <div class="w-full p-5 rounded-lg border border-blue-300 bg-blue-200 text-blue-900">Info Alert</div>
   <div class="w-full p-5 rounded-lg border border-gray-200 bg-gray-100 text-gray-600">Light Alert</div>
   <div class="w-full p-5 rounded-lg border border-gray-600 bg-gray-500 text-gray-900">Dark Alert</div>
</div>

<!-- alert with link -->
<div class="p-24 bg-green-600 flex flex-col justify-center items-center space-y-5">
   <h3 class="pb-10 font-bold text-4xl text-green-900 text-center">Alert with Link Color</h3>
   <div class="w-full p-5 rounded-lg border border-blue-400 bg-blue-300 text-blue-900">Primary Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
   <div class="w-full p-5 rounded-lg border border-gray-500 bg-gray-400 text-gray-900">Secondary Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
   <div class="w-full p-5 rounded-lg border border-green-400 bg-green-300 text-green-900">Success Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
   <div class="w-full p-5 rounded-lg border border-red-400 bg-red-300 text-red-900">Danger Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
   <div class="w-full p-5 rounded-lg border border-yellow-400 bg-yellow-300 text-yellow-900">Warning Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
   <div class="w-full p-5 rounded-lg border border-teal-400 bg-teal-300 text-teal-900">Info Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
   <div class="w-full p-5 rounded-lg border border-gray-200 bg-gray-100 text-gray-600">Light Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
   <div class="w-full p-5 rounded-lg border border-gray-600 bg-gray-500 text-gray-900">Dark Alert with matching <a href="#" class="font-bold underline">link</a> color.</div>
</div>

<!-- headings, paragraphs, dividers -->
<div class="p-24 bg-green-400 flex flex-col justify-center items-center space-y-5">
   <h3 class="pb-10 font-bold text-4xl text-green-900 text-center">Headings, Paragraphs, and Dividers</h3>

   <div class="w-full p-5 rounded-lg border border-green-400 bg-green-300 text-green-900 divide-y-2 divide-solid divide-green-400">
      <h2 class="font-bold text-xl pb-2">Congratulations!</h2>
      <p class="pt-2">You have successfully recreated Bootstrap's alert box in <a href="https://tailwindcss.com/" class="font-bold underline">Tailwind CSS</a>.</p>
   </div>

   <div class="w-full p-5 rounded-lg border border-yellow-400 bg-yellow-300 text-yellow-900 divide-y-2 divide-solid divide-yellow-400">
      <h2 class="font-bold text-xl pb-2">Warning!</h2>
      <p class="pt-2">May cause excessive fun when using Tailwind CSS.</p>
   </div>
</div>

<!-- adding icons -->
<div class="p-24 bg-green-800 flex flex-col justify-center items-center space-y-5">
   <h3 class="pb-10 font-bold text-4xl text-green-200 text-center">Adding Icons on Alerts</h3>
   <div class="w-full p-5 rounded-lg border border-blue-400 bg-blue-300 text-blue-900 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
         </svg>
      </span>
      Primary Alert
   </div>
   <div class="w-full p-5 rounded-lg border border-gray-500 bg-gray-400 text-gray-900 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
         </svg>
      </span>
      Secondary Alert
   </div>
   <div class="w-full p-5 rounded-lg border border-green-400 bg-green-300 text-green-900 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 10h4.764a2 2 0 011.789 2.894l-3.5 7A2 2 0 0115.263 21h-4.017c-.163 0-.326-.02-.485-.06L7 20m7-10V5a2 2 0 00-2-2h-.095c-.5 0-.905.405-.905.905 0 .714-.211 1.412-.608 2.006L7 11v9m7-10h-2M7 20H5a2 2 0 01-2-2v-6a2 2 0 012-2h2.5" />
         </svg>
      </span>
      Success Alert
   </div>
   <div class="w-full p-5 rounded-lg border border-red-400 bg-red-300 text-red-900 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
         </svg>

      </span>
      Danger Alert
   </div>
   <div class="w-full p-5 rounded-lg border border-yellow-400 bg-yellow-300 text-yellow-900 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
         </svg>
      </span>
      Warning Alert
   </div>
   <div class="w-full p-5 rounded-lg border border-teal-400 bg-teal-300 text-teal-900 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
         </svg>
      </span>
      Info Alert
   </div>
   <div class="w-full p-5 rounded-lg border border-gray-200 bg-gray-100 text-gray-600 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
         </svg>
      </span>
      Light Alert
   </div>
   <div class="w-full p-5 rounded-lg border border-gray-600 bg-gray-500 text-gray-900 flex">
      <span class="mr-2">
         <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
         </svg>
      </span>
      Dark Alert
   </div>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console