Do forms need to have visible labels?

Question

Do my form elements need to have visible labels or is placeholder text good enough?

Answer

It is best to ensure that all form inputs have a visible label. Visible labels help users understand the input's purpose. Placeholder text does not suffice and should not be considered as "good enough".

There are situations where a label for a form element can be hidden visually, given that there is still sufficient context about what the user should expect. For example, as search text input with a corresponding "Search" button, where "Search" is visible text in the button.