Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Styling default color of value= text in form field

Featured Replies

I'm missing something here. I want to change the color of the default value for this text field, without changing the overall color of the input field. For example, the default value of 170 will be gray, but when a user overwrites the data with their own numerical value, it will be black. I know how to change the color of the input field when a user types in data, but is there a way to change the color of the value= ?

 

<input type="text" name="trans1_1" size="6" value="170"/>

 

Any ideas? Seems like a simple task, but can't figure it out. Thanks in advance for the time.

I might be missing something here... but

 

input
{
color: #333
}

 

?

Here's what you do:

 

<input id="myid" type="text" name="trans1_1" size="6" value="170"/>

 

input[type="text"]#myid{ color: #666666;}
input[type="text"]#myid:focus{ color: #000000;}

 

Here's a link to the DEMO.

 

Note that the style checks that it's a text type and has an id of myid.

 

+1 me if I've helped! :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.