What Is Autofocus Property

The autofocus property sets or returns whether a text field should automatically get focus when the page loads, or not. This property reflects the HTML autofocus attribute.

What is the autofocus in HTML?

The autofocus attribute in HTML is used to specify that the element should get focused when the page loads. It is a boolean attribute.

How do I remove an input field from autofocus?

  1. remove all focus’s outline :focus { outline: 0; }
  2. add the new focus’s outline :link:focus, :visited:focus { outline: none; }
Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest