- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Place the image at the top inside a Bootstrap 4 card
Use the card-img-top class in Bootstrap 4, to set the image at the top inside a card in Bootstrap 4 −
Add the image inside the card class −
<img class="card-img-top" src="Image-Source" alt="Alt-Text" style="width:100%">
Now add the card body that includes title and text −
<div class="card-body"> <h4 class="card-title">Swift 4</h4> <p class="card-text">Learn Swift 4</p> <a href="#" class="btn btn-primary">Begin</a> </div>
The following is an example to place an image at the top inside a Bootstrap 4 card −
Example
<!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>SWIFT 4 Tutorial</h3> <p>Video Tutorial on Switft 4</p> <div class="card" style="width:350px"> <img class="card-img-top" src="https://www.tutorialspoint.com/assets/videotutorials/courses/swift_4_online_training/380_course_210_image.jpg" alt="Swift 4" style="width:100%"> <div class="card-body"> <h4 class="card-title">Swift 4</h4> <p class="card-text">Learn Swift 4</p> <a href="#" class="btn btn-primary">Begin</a> </div> </div> </div> </body> </html>
Advertisements