Reputation: 1322
How can i style the values that in a textfield, for example: if if i have the values Science, Mathematics
in a textfield. In place of having a comma separating them, i would want to display these subjects in boxes or something. Like adding tags to a questing in stackoverflow!
Upvotes: 1
Views: 268
Reputation: 103358
The textbox you see on stackoverflow, isn't a textbox.
Its most probably a div
with a border, with span
tags for each tag. Then there is a textbox
(without borders) floated next to it.
This gives the appearance of the tags actually being inside the textbox, when they're not.
When you click space, this is then adding a new record to the tags.
See this jQuery plugin for an example:
http://loopj.com/jquery-tokeninput/
Upvotes: 1
Reputation:
You can't do this with CSS alone. You will have to use some sort of javascript/jquery Plugin to accomplish this task.
Here is one I've used. It is pretty good:
http://harvesthq.github.com/chosen/
Upvotes: 2
Reputation: 32286
What is a textfield? Is it <textarea>
? You cannot style distinct textual elements in it as it is not a container. Check out JavaScript rich-text editors out there if you need text formatting/coloring inside an editable field. FCKEditor is one example.
Upvotes: 0