Akki619 Akki619 - 1 year ago 97
CSS Question

Input placeholder using CSS only

I know there are lot's of questions regarding this query here but none of them provide the solution for me.


<input id="tb1" type="text" class="note" />


<p class="note1"> This is not done.</p>


content: "Note:";

content: "Enter your number";

I am trying with above code and the variation as found on the web but none seems to work for input tag. It's working for p tag.

EDIT: I can't add value attribute to input tag and manage css for the desired result. It's the limitation of the system.

EDIT2: Forget about my css, is there any way that placeholder text is possible without using placeholder attribute and just with plain css for
input type="text"

Answer Source

It doesn't work for the simple fact that this:

<input id="tb1" type="text" class="note"></input>

is not valid. <input /> elements are not containers. As the spec notes, endtags are forbidden (and essentially ignored by the browser): http://www.w3.org/TR/html401/interact/forms.html#h-17.4

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download