0

I want to increase the size of first word of the paragraph in html, which tag can be used for this.

I tried the (first letter) tag and expected a output to be a paragraph with increased size of first letter, but I didn't got any answer.

Nisha
  • 11
  • 2
  • 1
    you can find your answer [enter link description here](https://stackoverflow.com/questions/40042740/style-first-word-of-paragraph) – Ahsan Roomi Dec 22 '22 at 05:45

4 Answers4

1

p {
  font-size: 2rem;
}

.big {
  font-size: 3rem;
}
<p><span class="big">Ash</span> Finally became the Pokemon champion</p>

This is the easiest and perhaps best way to approach this. Hope it helps!

Graham
  • 61
  • 5
0

This was answered here: https://stackoverflow.com/questions/55612/css-to-select-style-first-word

There is a selector for first-letter, but for the selecting the first word you'll have to stick with the class solution as suggested by Graham

Ravid
  • 311
  • 3
0

You can use span tag. For example,

<!DOCTYPE html>
<html>
<head>
<title> Lecture</title>
<style>

</style>
</head>

<body>
<p><span style="font-size: larger;">Hello !</span> My name is xyz. </p>
</body>
</html>
0

<!DOCTYPE html>
<html>
  <head>
    <style>
      p::first-letter {
        font-size: 200%;
        color: #black;
      }
    </style>
  </head>
  <body>
    <p>Is this correct</p>
  </body>
</html>