ফ্লোট এবং মিডিয়া কোয়েরি ব্যবহার করে রেসপন্সিভ টেস্টিমোনিয়াল কার্ড তৈরি করা যায় যা মোবাইলে সেন্টার্ড হয়ে যায়।
উদাহরণ: রেসপন্সিভ টেস্টিমোনিয়াল
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; }
.testimonialContainer {
border: 2px solid rgba(0, 0, 0, 0.363);
background-color: rgb(207, 235, 218);
border-radius: 5px; padding: 16px; margin: 16px 0;
}
.profilePic { width: 100px; height: 100px; }
.testimonialContainer::after { content: ""; clear: both; display: table; }
.testimonialContainer img { float: left; margin-right: 20px; border-radius: 50%; }
.testimonialContainer span { font-size: 24px; font-weight: 500; margin-right: 15px; color: purple; }
.testimonialContainer p { font-size: 18px; font-style: oblique; }
@media (max-width: 500px) {
.testimonialContainer { text-align: center; }
.testimonialContainer img { margin: auto; float: none; display: block; }
}
</style>
</head>
<body>
<h1>রেসপন্সিভ টেস্টিমোনিয়াল উদাহরণ</h1>
<div class="testimonialContainer">
<img class="profilePic" src="https://images.pexels.com/photos/614810/pexels-photo614810.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"/>
<span>জেমস অ্যান্ডারসন</span>
<p>শন একটি পরিশ্রমী এবং কমিটেড ব্যক্তি</p>
</div>
<div class="testimonialContainer">
<img class="profilePic" src="https://images.pexels.com/photos/2128807/pexels-photo2128807.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"/>
<span>স্টিভ বোল্ডার</span>
<p>শন মানুষ ম্যানেজমেন্টে দক্ষ</p>
</div>
</body>
</html>
কোড ব্যাখ্যা
- .testimonialContainer::after { clear: both }: ফ্লোট ক্লিয়ার।
- img { float: left; border-radius: 50%; }: প্রোফাইল পিক সার্কুলার।
- @media (max-width: 500px): মোবাইলে ইমেজ সেন্টার, টেক্সট সেন্টার।
আধুনিক পদ্ধতি
Flexbox (`display: flex; align-items: center; flex-wrap: wrap`) বা Grid ব্যবহার করলে ফ্লোট/ক্লিয়ারফিক্সের প্রয়োজন নেই।