কম্পিউটার টিউটোরিয়াল

CSS-এ Em ব্যবহার করে ফন্ট আকার সেট করুন


CSS-এ font-size প্রপার্টি সেট করতে em ব্যবহার করুন। টেক্সটের জন্য পিক্সেল নির্ভুলতা দরকার হলে এটি উপযোগী। ডিফল্টভাবে ১em = ১৬px, এবং ২em = ৩২px।

উদাহরণ

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
  text-decoration: overline;
  text-decoration-color: yellow;
  font-size: 1.3em;
}
</style>
</head>
<body>
<h1>Examination Details</h1>
<p class="demo">Exam on 20th December.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

আউটপুট

CSS-এ Em ব্যবহার করে ফন্ট আকার সেট করুন

উদাহরণ

আরেকটি উদাহরণ:

<!DOCTYPE html>
<html>
<head>
<style>
div {
  text-align: justify;
  text-justify: inter-word;
  color: white;
  background-color: gray;
  font-size: 1.5em;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<div>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. </div>
</body>
</html>

আউটপুট

CSS-এ Em ব্যবহার করে ফন্ট আকার সেট করুন


  1. CSS দিয়ে টেক্সট ইন্ডেন্টেশন (Text Indentation) কাজ করা

  2. CSS-এ Em ব্যবহার করে ফন্ট সাইজ সেট করা

  3. CSS-এ কীওয়ার্ড দিয়ে ফন্ট সাইজ সেট করা: absolute ও relative keywords

  4. CSS-এ ফন্ট সাইজ: পিক্সেল, em, rem, পৰসেন্টেজ ও কীওয়ার্ড