Style Bootstrap 4 card with bg-warning class


Use the bg-warning class with the card class in Bootstrap to set warning action on a Bootstrap card.

Set warning messages like −

Do not cross!
High Voltage!

Use the below code to style a Bootstrap card −

<div class="card bg-warning">
  <div class="card-body">You are trespassing on private property!</div>
</div>

You can try to run the following code to style Bootstrap card with the bg-warning class −

Example

Live Demo

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  </head>
<body>
  <div class="container">
    <h3>Warning</h3>
    <div class="card bg-warning">
      <div class="card-body">You are trespassing on private property!</div>
    </div>
  </div>
</body>
</html>

Updated on: 18-Jun-2020

275 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements