Solved

Background Colors

Posted on 2011-03-25
9
258 Views
Last Modified: 2012-05-11
Is there anyway to give these text a background color? I'd like for the "Due Date:" to have a background of #357EC7 & all of the others (due_1, due_2, etc.) to have the background color of #3BB9FF

Is this possible? I need some type of background colors so those fields will stand out when viewed on paper...thanks!
<td><b>Due Date:</b> <br>
<input type="text" name="due_1" size="25" maxlength="30" value="'. $row['due_1'] .'" /> </br> <br> 
<input type="text" name="due_2" size="25" maxlength="30" value="'. $row['due_2'] .'" /> </br><br> 
<input type="text" name="due_3" size="25" maxlength="30" value="'. $row['due_3'] .'" /> </br><br>
<input type="text" name="due_4" size="25" maxlength="30" value="'. $row['due_4'] .'" /> </br><br>
<input type="text" name="due_5" size="25" maxlength="30" value="'. $row['due_5'] .'" /> </td>

Open in new window

0
Comment
Question by:wantabe2
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 10

Expert Comment

by:10023
ID: 35218395
<HTML>
<HEAD>

<TITLE></TITLE>
<LINK REV="made" HREF="mailto:">
<META NAME="generator" CONTENT="NoteTab Light 6.2">
<META NAME="author" CONTENT="">
<META NAME="description" CONTENT="">
<META NAME="keywords" CONTENT="">

<STYLE TYPE="text/css">
<!--
... Type style here!
-->
</STYLE>
</HEAD>

<BODY>
<table>
<tr>
<td><b>Due Date:</b> <br>
<input type="text" name="due_1" size="25" maxlength="30"style = "background-color: #3BB9FF;" value="'. $row['due_1'] .'" /> </br> <br>
<input type="text" name="due_2" size="25" maxlength="30" style = "background-color: #357EC7;"'. $row['due_2'] .'" /> </br><br>
<input type="text" name="due_3" size="25" maxlength="30"style = "background-color: #357EC7;" value="'. $row['due_3'] .'" /> </br><br>
<input type="text" name="due_4" size="25" maxlength="30" style = "background-color: #357EC7;"value="'. $row['due_4'] .'" /> </br><br>
<input type="text" name="due_5" size="25" maxlength="30" style = "background-color: #357EC7;" value="'. $row['due_5'] .'" /> </td>
</tr>
</table>

</BODY>
</HTML>
0
 
LVL 8

Accepted Solution

by:
Rik-Legger earned 500 total points
ID: 35218400
<td style="background-color: #357EC7;"><b>Due Date:</b> <br>
<input style="background-color: #3BB9FF;" type="text" name="due_1" size="25" maxlength="30" value="'. $row['due_1'] .'" /> </br> <br> 
<input style="background-color: #3BB9FF;" type="text" name="due_2" size="25" maxlength="30" value="'. $row['due_2'] .'" /> </br><br> 
<input style="background-color: #3BB9FF;" type="text" name="due_3" size="25" maxlength="30" value="'. $row['due_3'] .'" /> </br><br>
<input style="background-color: #3BB9FF;" type="text" name="due_4" size="25" maxlength="30" value="'. $row['due_4'] .'" /> </br><br>
<input style="background-color: #3BB9FF;" type="text" name="due_5" size="25" maxlength="30" value="'. $row['due_5'] .'" /> </td>

Open in new window

0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 35218449
This works if you specify the width.
<td><div style="background-color:#357EC7;width:175px;"><b>Due Date:</b><br>
<input type="text" name="due_1" size="25" style="background-color:#3BB9FF;width:173px;" maxlength="30" value="'. $row['due_1'] .'" /> </br> <br> 
<input type="text" name="due_2" size="25" style="background-color:#3BB9FF;width:173px;" maxlength="30" value="'. $row['due_2'] .'" /> </br><br> 
<input type="text" name="due_3" size="25" style="background-color:#3BB9FF;width:173px;" maxlength="30" value="'. $row['due_3'] .'" /> </br><br>
<input type="text" name="due_4" size="25" style="background-color:#3BB9FF;width:173px;" maxlength="30" value="'. $row['due_4'] .'" /> </br><br>
<input type="text" name="due_5" size="25" style="background-color:#3BB9FF;width:173px;" maxlength="30" value="'. $row['due_5'] .'" /> </td>
</div>

Open in new window

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 15

Author Comment

by:wantabe2
ID: 35224368
Rik-Legger,
Yours works perfect! Why doesn't show when I print it? I know there is a setting on the IE browser to print background images/colors but I have that enabled. I'm using IE...is there something in the code that is not allowing it to be printed? It doesn't even show in the print preview...
0
 
LVL 8

Expert Comment

by:Rik-Legger
ID: 35226072
I believe that is some kind of setting in your browser/print software.
Don't know much about that either, but it is not something you can 'turn on/off' through HTML.
So the code should be good, just try to figure out the also print background colors.
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 35226107
wantabe2,
What browser are you using. I don't see the #357EC7 color showing up in any browser I've tried using Rik-Legger's code.
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 35226177
Nevermind, my mistake.
0
 
LVL 15

Author Comment

by:wantabe2
ID: 35228386
I'm using IE
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 35230588
You're going to struggle with this one. The default option is to not print background images and colours. Whilst there is an option to turn on background printing, I would guess that the majority of 'standard' web users don't know about it, or don't bother changing it, so you really can't rely on it.

If you want the various inputs to stand out when printed, you might try adding a coloured, bold border to each one. You can do this only for printing by attaching a print specific style sheet. Keep your background colours in your normal style sheet and set different borders only for printing.

Add a print specific style sheet in the head of you document.

Looking at your code, you'll probably want to add a class or ID to the various elements so that you can style it with your style sheet


//add print style sheet to your document
<link rel="stylesheet" media="print" href="printStyles.css" type="text/css" />

//Then in your printStyles.css 
#DueDates b { border: 2px solid #357EC7; }
#DueDates input { border: 2px solid #3BB9FF; }

//Add an ID to your html 
<td id="DueDates"><b>Due Date:</b><br>
<input type="text" name="due_1" size="25" maxlength="30" value="'. $row['due_1'] .'" /> </br> <br> 
<input type="text" name="due_2" size="25" maxlength="30" value="'. $row['due_2'] .'" /> </br><br> 
<input type="text" name="due_3" size="25" maxlength="30" value="'. $row['due_3'] .'" /> </br><br>
<input type="text" name="due_4" size="25" maxlength="30" value="'. $row['due_4'] .'" /> </br><br>
<input type="text" name="due_5" size="25" maxlength="30" value="'. $row['due_5'] .'" /> </td>

Open in new window

0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Log in through ID 5 19
Ajax and PHP 9 31
Amazon S3 .Net error 5 21
custom authorization on controller action and HTML in asp.net mvc 1 29
This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question