Tutorialspoint examples

Learn java tutorial with examples for beginners online

Bootstrap 4 card image overlay tutorial

Bootstrap 4 card represents a bordered box with some padding around its content. It includes options for headers, footers, content, colors, etc. Bootstrap provides the following classes to create bootstrap card.
.card: class is used to create a bootstrap card.
.card-body: class is used to add content inside the card.
.card-header: class is used to add a heading to the card.
.card-footer: class is used to add a footer to the card.

The .card-img-overlay class is used to add text on top of the image. Image will be in card background.

Bootstrap Card Image Overlay Example:

<!DOCTYPE html>
<html lang="en">
  <title>Bootstrap Card Image Overlay 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.0.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<div class="container">
  <h2>Bootstrap Card Image Overlay Example</h2>
  <div class="card img-fluid" style="width:400px">
    <img class="card-img-top" src="test.jpg" alt="Card image" style="width:100%">
    <div class="card-img-overlay">
      <h4 class="card-title">sandy</h4>
      <p class="card-text">Some information about sandy. Some information about sandy. Some information about sandy . Some information about sandy </p>
      <a href="#" class="btn btn-primary">See Profile</a>

Try it:

Bootstrap Card Image Overlay Example on jsbin.com

Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status