Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > little question

Reply
Thread Tools

little question

 
 
Eirk
Guest
Posts: n/a
 
      05-23-2005
Hi,
is there any way to give focus to an INPUT type=file *textfield* using
css? That is:

--->this works:


input[type="text"]:focus {
background-color: #FFCC00;
}




--->while this doesn't work:


input[type="file"]:focus {
background-color: #FFCC00;
}


Any idea?
Eirk
 
Reply With Quote
 
 
 
 
mark | r
Guest
Posts: n/a
 
      05-23-2005

"Eirk" <> wrote in message
news:greke.112809$...
> Hi,
> is there any way to give focus to an INPUT type=file *textfield* using
> css? That is:
>
> --->this works:


> input[type="text"]:focus {
> background-color: #FFCC00;
> }
> --->while this doesn't work:


> input[type="file"]:focus {
> background-color: #FFCC00;
> }


> Any idea?
> Eirk


nice CSS, i didnt know that!

mark


 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      05-24-2005
Eirk <> wrote:

>is there any way to give focus to an INPUT type=file *textfield* using
>css? That is:
>
>--->this works:
>
>input[type="text"]:focus {
> background-color: #FFCC00;
>}


Nitpick - that doesn't "give focus" to the element, it just changes
the style of the element when it recieves focus.

(And of course IE doesn't support attribute selectors or the :focus
pseudo class, but you probably know that)

>--->while this doesn't work:
>
>input[type="file"]:focus {
> background-color: #FFCC00;
>}


The file input is effectively unstylable. As most (but not all)
browsers display it as a combination of two widgets and as CSS
doesn't provide any way to address those two widgets independently
there's no not a lot you can do.

(Also would you want the focus state to be triggered when the focus
was on the textbox widget or the button widget or both?)

Some people go down a rather convoluted route whereby they hide the
actual <input type="file"> and instead have a standard text input and
a standard button that can be styled independently. They then use
JavaScript to pass actions and results back and forth between the
real, hidden input and the fake, visible ones.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <> <http://steve.pugh.net/>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 little 2 little 3 little Kennedys dale Digital Photography 0 03-23-2008 01:03 PM
having a little problem with some code for a little game I am creating. ThaDoctor C++ 3 09-28-2007 03:28 PM
little red X in little white box Puzzled Computer Support 8 12-13-2004 09:11 AM
A little question about asp.net 2 Luigi Corrias ASP .Net 3 10-27-2004 02:13 PM
Little project question Kerberoz Perl 0 11-28-2003 04:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57