0

Can I use other elements inside the placeholder of the input tag? something like this:

    <input placeholder='search for a restaurant, cuisine, or a dish' className='form-control'/>

if I Want the placeholder to be bold, can I use something like

    <input placeholder='<h1>search for a restaurant, cuisine, or a dish <h1/>' className='form-control'/>

will it work? Is there any other way to do it?

ash
  • 1,065
  • 1
  • 5
  • 20
  • Does this answer your question? [Placeholder font-size bigger than 16px](https://stackoverflow.com/questions/30916387/placeholder-font-size-bigger-than-16px) – xitas Feb 19 '22 at 12:45
  • https://stackoverflow.com/tour . As you are a new user you can have one. @gratus – ash Feb 19 '22 at 12:57

1 Answers1

3

No, you cannot add foreign child or context Elements per-se inside an input (like i.e: the pseudo ::before or ::after).

Just style the ::placeholder selector

::placeholder {
  color: red;
  font-weight: 800;
}
<input type="text" placeholder="search for a restaurant, cusine, or a dish" class="form-control" />
Roko C. Buljan
  • 196,159
  • 39
  • 305
  • 313
ash
  • 1,065
  • 1
  • 5
  • 20