how do i code my stylesheet so tht when a user clicks on a text box to write something the border colour of the text box changes?
highlighted text boxes
after looking w3schools.org and Lisssa Explains.com i wrote this little code:
this part in your stylesheet:
and this part in your body whereever you want:
also you can find other attributes in the given webpage...
this part in your stylesheet:
| Code: |
| textarea{
border-color: green; border-style: solid; } |
and this part in your body whereever you want:
| Code: |
| <textarea rows="3" cols="70" onfocus="this.style.borderColor = 'red';" onblur="this.style.borderColor = 'green';">
The cat was playing in the garden. Suddenly a dog showed up..... </textarea> |
also you can find other attributes in the given webpage...
Another way is to use the below. Its only hover as opposed to actually clicking in it, but it will work for those without javascript as well
EDIT: Use jylan's below. He's got it!
Last edited by mathiaus on Fri Aug 24, 2007 9:29 am; edited 1 time in total
| Code: |
| textarea:hover { border: 1px solid red; } |
EDIT: Use jylan's below. He's got it!
Last edited by mathiaus on Fri Aug 24, 2007 9:29 am; edited 1 time in total
Hi riyadh,
To put a border around the textarea use alem's css code. You can then use the :focus pseudo-class to change the style of the textarea when a user selects it. See my code below.
To put a border around the textarea use alem's css code. You can then use the :focus pseudo-class to change the style of the textarea when a user selects it. See my code below.
| Code: |
|
textarea { border:1px solid green; } textarea:focus { border:1px solid red; } |
