Native HTML tag for small caps

549 views Asked by At

In CSS, I can do small caps like:

<span style="font-variant: small-caps;">Jane Doe</span>

But is there a native HTML tag for small caps?

1

There are 1 answers

0
Dhruv Tiwari On

There isn't a native HTML tag specifically for small caps text. To display text in small caps, you can use CSS to style your text. You can apply the font-variant property to achieve this effect. Here's an example:

<!DOCTYPE html>
<html>
<head>
<style>
  .small-caps {
    font-variant: small-caps;
  }
</style>
</head>
<body>

<p>This is normal text.</p>
<p class="small-caps">This is small caps text.</p>

</body>
</html>

In the example above, the

element with the class "small-caps" has the font-variant property set to "small-caps," which renders the text in small capital letters. You can apply this style to any HTML element by giving it the appropriate class or by targeting elements with CSS selectors.