[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to add background color to a specific area

Posted on 2008-10-06
10
Medium Priority
?
183 Views
Last Modified: 2012-05-05
Greetings,

I am new to html and I need to add background color (lime green) to the box below.  I believe this would be the code as it stands now:

      <tr>
        <td colspan="2" style="border-right: gray thin solid; border-top: gray thin solid; border-left: gray thin solid; border-bottom: gray thin solid; padding-bottom: 15px; padding-top: 15px;">
           $TEXT</td>
      </tr>
      <tr style="background-color:#BBBBBB; height:1px;">

Would I replace the  :#BBBBBB  with  #00FF00  or does this color apply to something else?

Thanks


text-box.JPG
0
Comment
Question by:John500
  • 5
  • 4
10 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 22650864
>>Would I replace the  :#BBBBBB  with  #00FF00  or does this color apply to something else?
Yes.

It applies to the background of the row.
0
 
LVL 82

Expert Comment

by:hielo
ID: 22650881
BTW:
#00FF00 is green.

limegreen is more like:
#32cd32
0
 

Author Comment

by:John500
ID: 22650888
I just tried it and the only thing that gets colored is the bottom line.  The line is still grey but behind the line is green.

How would the whole box get the color?

Thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:John500
ID: 22650910
Actually I'd like to try two ways:

1)  change the $TEXT color to lime green
2)  change background color of the box lime green
0
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 22650913
you need to apply:
style="background-color:#BBBBBB; height:1px;"

to the  that contains the text you want colored:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
<title></title>
</head>
<body>
<table summary=""> 
 <tr style="background-color:#32cd32;">
        <td colspan="2" style="border-right: gray thin solid; border-top: gray thin solid; border-left: gray thin solid; border-bottom: gray thin solid; padding-bottom: 15px; padding-top: 15px;">
           $TEXT
	   </td>
  </tr>
</table>
</body>
</html>

Open in new window

0
 
LVL 82

Expert Comment

by:hielo
ID: 22650928
change the background => style="background-color:#32cd32;"

change the text color => style="color:#32cd32;"
0
 

Expert Comment

by:TunaMaxx
ID: 22650943
The way you have it, the green background would start in the NEXT table row (<TR>) element, and then that row would only be 1 pixel tall.

Just replace your FIRST <TR> in your provided code with your LAST <TR> statement, and ditch the 'height: 1px;' like this:

 
<tr style="background-color:#BBBBBB;>
    <td colspan="2" style="border-right: gray thin solid; border-top: gray thin solid; border-left: gray thin solid; border-bottom: gray thin solid; padding-bottom: 15px; padding-top: 15px;">$TEXT</td>
</tr>
<tr style="background-color:#BBBBBB; height:1px;">

Open in new window

0
 

Author Comment

by:John500
ID: 22651049
Ok, and finally - if I were to test these options statically would I just remove the $TEXT and replace it with something within quotes - or what?

Thanks!
0
 
LVL 82

Expert Comment

by:hielo
ID: 22651079
just replace $TEXT with the content. Quotes are not necessary:

 <tr style="background-color:#32cd32;">
        <td colspan="2" style="border-right: gray thin solid; border-top: gray thin solid; border-left: gray thin solid; border-bottom: gray thin solid; padding-bottom: 15px; padding-top: 15px;">
           Hello there
         </td>
  </tr>

Open in new window

0
 

Author Closing Comment

by:John500
ID: 31503453
Thank you sir ....
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

865 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