Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Dec 2003
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to change the color of the text in a inputbox?

    It's all in the subject!!! I'v tried everything. I thought this should do it, but it don't. font-family: 'Verdana'; font-color: '#666666';

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    <style type="text/css">
    input{
    color:#666666;
    }
    </style>

  • #3
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <input type="text" style="font-family: verdana, helvetica, serif; color: #666;" />

  • #4
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by fredmv
    Code:
    <input type="text" style="font-family: verdana, helvetica, serif; color: #666;" />
    Eww, inline styles
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #5
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by me'
    Eww, inline styles
    I usually use external stylesheets as well, but in this specfic instance I didn't know if he wanted only one textbox to have a different style or not. Therefore, I assumed he only needed it for one textbox and it wouldn't make sense to create a create an embedded stylesheet (maybe an id would have been good in this case but I wanted to keep it even simpler therefore not requring any selectors whatsoever).

  • #6
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    (sorry if this appears patronising fredmv, this is aimed at anyone that reads this thread, and not really you)

    IDs would still be better than inline styles. I accept it as convenience of example, but in practice, you're better off reffering to it with an ID if there's only one you need, or a class if there's more than one. Using inline styles mixes your style and content, and defeats the entire point of CSS.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #7
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No offense taken on my part.

    I completely agree. But as you say, in this specific instance I just wanted simpliciity for the example, but when used in real context I would, myself, also use an id if there was only one element in which needed that specific style.

  • #8
    Regular Coder
    Join Date
    Dec 2003
    Location
    USA
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I once heard someone say...
    If it's style to be used across your entire site, on every page, slap it in an external stylesheet.

    If it's going to be used multiple times, but only one on page, stick it in some <style> tags.

    If it's going to be used only once, on one page, use inline styles.
    Not the exact wording, but something to that affect.

    I go by this method; makes sense to me.

  • #9
    Senior Coder
    Join Date
    Aug 2002
    Location
    A 4D universe
    Posts
    1,337
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is wrong either way.

    Classes are used for instances that appear more than once in one page e.g.:
    Code:
    .text {
      color: #777;
      text-decoration: none;
    }
    That will pick up any tag with class="text" stuck on it.

    ID's are used for instances that may appear once, e.g. a logo, and have '#' instead of '.' used, with id="text" instead, where '.text' would be '#text'.

    You don't just stick in <style> tags, and you avoid inline tags as like using tables for layouts.
    http://www.mudsplat.com - Web design, print, and marketing solutions.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •