Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-28-2003, 12:56 PM   PM User | #1
hvadseth79
New Coder

 
Join Date: Dec 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
hvadseth79 is an unknown quantity at this point
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';
hvadseth79 is offline   Reply With Quote
Old 12-28-2003, 01:31 PM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
<style type="text/css">
input{
color:#666666;
}
</style>
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 12-28-2003, 01:33 PM   PM User | #3
fredmv
Regular Coder

 
Join Date: Jul 2003
Location: Massachusetts
Posts: 472
Thanks: 0
Thanked 0 Times in 0 Posts
fredmv is an unknown quantity at this point
Code:
<input type="text" style="font-family: verdana, helvetica, serif; color: #666;" />
fredmv is offline   Reply With Quote
Old 12-28-2003, 05:44 PM   PM User | #4
me'
Senior Coder

 
Join Date: Nov 2002
Location: Warwickshire, England
Posts: 1,229
Thanks: 0
Thanked 0 Times in 0 Posts
me' is an unknown quantity at this point
Quote:
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!
me' is offline   Reply With Quote
Old 12-28-2003, 06:00 PM   PM User | #5
fredmv
Regular Coder

 
Join Date: Jul 2003
Location: Massachusetts
Posts: 472
Thanks: 0
Thanked 0 Times in 0 Posts
fredmv is an unknown quantity at this point
Quote:
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).
fredmv is offline   Reply With Quote
Old 12-28-2003, 06:03 PM   PM User | #6
me'
Senior Coder

 
Join Date: Nov 2002
Location: Warwickshire, England
Posts: 1,229
Thanks: 0
Thanked 0 Times in 0 Posts
me' is an unknown quantity at this point
(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!
me' is offline   Reply With Quote
Old 12-28-2003, 06:06 PM   PM User | #7
fredmv
Regular Coder

 
Join Date: Jul 2003
Location: Massachusetts
Posts: 472
Thanks: 0
Thanked 0 Times in 0 Posts
fredmv is an unknown quantity at this point
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.
fredmv is offline   Reply With Quote
Old 12-28-2003, 06:26 PM   PM User | #8
Paul Jr
Regular Coder

 
Join Date: Dec 2003
Location: USA
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
Paul Jr is an unknown quantity at this point
I once heard someone say...
Quote:
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.
Paul Jr is offline   Reply With Quote
Old 12-28-2003, 06:34 PM   PM User | #9
ionsurge
Senior Coder

 
Join Date: Aug 2002
Location: A 4D universe
Posts: 1,337
Thanks: 0
Thanked 0 Times in 0 Posts
ionsurge is an unknown quantity at this point
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.
ionsurge is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 12:33 PM.


Advertisement
Log in to turn off these ads.