Limbo
Limbo

Reputation: 31

How to target CSS form labels/values?

I'm trying to mimic the placeholder attribute in my login/password form, using pure CSS.

Is there a way to do this? Can I absolutely positioning my label or values which say "user/password" to make them look like they are placeholder text in the field?

Not sure how to target the label/value.

<form>

<input type="text" id="username" label="username">

<input type="password" id="password" label="password">

</form>

Thanks all.

Upvotes: 3

Views: 1047

Answers (1)

mrtsherman
mrtsherman

Reputation: 39872

I would use the new placeholder css3 property and let old browsers be old browsers.

http://jsfiddle.net/fmr3J/

<input type="text" id="username" label="username" placeholder="username">
<input type="password" id="password" label="password" placeholder="password">

Upvotes: 2

Related Questions