You are here: Re: css form elements « HTML « IT news, forums, messages
Re: css form elements

Posted by Jonathan N. Little on 09/01/06 14:17

timothy.pollard@btinternet.com wrote:
> Hi all
>
> I've created a form where the form element and text styling is done by
> css. I've also set an initial value in my html which clears when you
> click in the box - so NAME appears in the form element where name goes,
> but this clears as soon as you click in it. Everything is fine except I
> want the initial value (NAME) to be in light grey but the text the user
> types in once the initial value has cleared to be black (e.g. Tim
> Pollard). I've seen this done on other sites, but can't figure out how
> to do it.
>
> Anybody know?
>
> Here's my style css for the text boxes:
>
> .blueform {
>
> font-family: Verdana, Arial, Helvetica, sans-serif;
> font-size: 8px;
> color: #96969A;
> border: 1px solid #7882b8;
> }
>
> Here's a typical html form element:
>
> <input name="EmlSubj" type="text" class="blueform" id="EmlSubj"
> value="SUBJECT" size="36" ONFOCUS="clearDefault(this)">
>
> Thanks in advance for any suggestions.

I will only comment that 8px is *extremely* small, have pity on the
middle-aged and make that font-size: 100%, and least 9em if you must reduce.

Make a class that has the input element the style you want after focus
and add to your JavaScript function "clearDefault()" to change the
className of parsed element to this class.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация