I have defined a custom class called .myclass
in the <style>
tag with a font-size
of 10rem
. However, the font size of the h1
element with the .myclass
and text-3xl
classes is not being set to 10rem
as expected. Can someone please explain why this is happening and suggest a solution?
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<style>
.myclass{
font-size: 10rem;
}
</style>
<body>
<h1 class="myclass text-3xl font-bold underline">
Hello world!
</h1>
</body>
</html>
I expected the h1
element with both the .myclass
and text-3xl
classes to have a font size of 10rem
. However, the font size of the h1
element was not being set to 10rem
as expected, and I was unsure why this was happening.
2
Answers
Option 1: Remove
.text-3xl
class. The text-size will be fully rely on.myclass
class.Option 2: You can change the configuration of Tailwind to use
10rem
for the.text-3xl
class.Add this script in Head or Body tag