473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

background color (Help)

i have a form as below where by default its background color is white

________
Name:
Address:

Activities:
Year:
Service:
_______

My question is how to change its portion of background color from white to pink? e.g. the background for Name and Address remain as white while starting from activities till service their background color will be pink?

Thanks
Aug 24 '09 #1
10 2377
code green
1,726 Expert 1GB
<div class="classname of css with bgcolor:pink>
Aug 24 '09 #2
@code green
Hi, thanks for your reply. I am totally new to php.
what is the "classname of css with bgcolor" ??

is it i need to put the above code that given by you before the Activities??
Thanks.
Aug 24 '09 #3
Dheeraj Joshi
1,123 Expert 1GB
CSS(Cascaded style sheet) it allows you to set the visual effects of your page...
(Like back ground color, font,size etc etc).

it has got nothing to do with PHP.

what code green meant was change external CSS file(Assuming you used one).
If you havent used. Create one.

You refere w3schools for help regarding CSS.

Regards
Dheeraj Joshi
Aug 24 '09 #4
@dheerajjoshim
Thanks.


i learnt that basically i need to insert

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. mybackground
  3. {
  4. background-color:#e0ffff;
  5. }
  6. </style>
between the

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.  
  4. </html>
  5. </head>
but now my problem is... i cant find the header in my web (myweb.php)


my web starting with something as below

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. class HTML_myweb
  4. {
  5.     function thankyou($option){
  6. ?>
  7.  
  8. <?php        
  9.     }
  10.     function show_form($option)
  11.     {
  12. ?>
  13.             <style>
  14.                 div#registerBox fieldset .redd{
  15.                     color:#ff0000;
  16.                 }
  17.             </style>
  18.  
  19. /* i add my css class here */
  20.  
  21.                    <style type="text/css">
  22.                    mybackground
  23.                      {
  24.                    background-color:#e0ffff;
  25.                     }
  26.                    </style>
  27.  
  28.  
  29. <p><label>Name:<span class="redd">*</span></label><input type="text" name="name" id="name" /></p>
  30. <p><label>Address:<span class="redd">*</span></label><input type="text" name="address" id="address" /></p>
  31.  
  32. /* i would like to change my background start from the line below */
  33. <mybackground>
  34. <p><label>Activities:<span class="redd">*</span></label><input type="text" name="activities" id="activities" /></p>
  35. <p><label>Year:<span class="redd">*</span></label><input type="text" name="year" id="year" /></p>
  36. <p><label>Service:<span class="redd">*</span></label><input type="text" name="service" id="service" /></p>
  37. </mybackground>
but when i try to run the code.. the form still the same ..nothing changed.
please guide
Aug 24 '09 #5
Dheeraj Joshi
1,123 Expert 1GB
Header may look like this

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. echo "<html>";
  3. header('Location: http://www.example.com/path/to/file');
  4. echo "</html>";
  5. ?>
  6.  
This is how your header must look like....

You can embed HTML code within PHP tag.. and just echo it.... or other way round.

Regards
Dheeraj Joshi
Aug 25 '09 #6
Dormilich
8,658 Expert Mod 8TB
the php code you have shown should throw an error.
Aug 25 '09 #7
Dheeraj Joshi
1,123 Expert 1GB
What error?

I remember once i used above code.. It didnot gave any error... What error you are talking about.?

Following must also work....

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. header("  ");
  3. ?>
  4.  
Aug 25 '09 #8
Hi Dormilich and dheerajjoshim,
when i insert the code.. i got NO error on that. Just the background color didnt change.
i search through the code i didnt find the "header" nor the " echo"
Aug 25 '09 #9
Dormilich
8,658 Expert Mod 8TB
@dheerajjoshim
I’d expect a ‘missing } error’. and as a personal note, I wouldn’t use a class for simple text, an include should work good enough.
Aug 25 '09 #10
Atli
5,058 Expert 4TB
A bit late on this, but...

The code posted by Dheeraj would in fact not work as expected.
The header function adds a header to the HTTP response, and has nothing to do with the HTML <header> tag.
And seeing as you put an echo call right before it, it would never even get executed. (HTTP headers can't be manipulated once content is added to the response.)

Doing header("Location: file.txt"); would not include a header into the current HTML source. It would redirect you to the "file.txt" file. (Which I assume is not what you wanted to happen.)

I'm not entirely sure what you are doing with that "HTML_myweb" class, MyMarlboro, but it seems a bit to complex for this particular problem.

The solution is pretty simple, actually.
Expand|Select|Wrap|Line Numbers
  1. <!-- file: index.html -->
  2. <html>
  3. <head>
  4.     <style type="text/css">
  5.         .bnw {
  6.             background-color: #ffffff;
  7.             color: #000000;
  8.         }
  9.         .wnb {
  10.             background-color: #000000;
  11.             color: #ffffff;
  12.         }
  13.     </style>
  14. </head>
  15. <body>
  16.     <p class="bnw">Black text, white background</p>
  17.     <p class="wnb">White text, black background</p>
  18. </body>
  19. </html>
Or, if you prefer to put the CSS into an external file:
Expand|Select|Wrap|Line Numbers
  1. /* file: styles.css */
  2. .bnw {
  3.     background-color: #ffffff;
  4.     color: #000000;
  5. }
  6. .wnb {
  7.     background-color: #000000;
  8.     color: #ffffff;
  9. }
Expand|Select|Wrap|Line Numbers
  1. <!-- file: index.html -->
  2. <html>
  3. <head>
  4.      <link rel="stylesheet" href="styles.css" media="all">
  5. </head>
  6. <body>
  7.     <p class="bnw">Black text, white background</p>
  8.     <p class="wnb">White text, black background</p>
  9. </body>
  10. </html>
None of that has anything to do with PHP. It's just HTML and CSS.
Aug 30 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Martin | last post by:
Dear Experts! I'd be grateful if you can help me with this. I'm having an inline frame which points to 'www.externalsite.com'. The page which contains the inline frame has an orange...
2
by: lorelei | last post by:
Hey all, I have found two seperate HTML codes which claim to stop background images from being tiled. Neither of them seem to be working. I'm writing my codes in Textpad, and use Internet...
8
by: Ron Holmes | last post by:
I want to place a background image on a windows form. Is there a way to prevent the image from Tiling without using an image box resized to the size of the form? I am using Visual Studio 2003...
3
by: Per Dunberg | last post by:
Hi all, I have to develop a "skinned" application and I have a problem with the graphics. When a form is loaded and displayed there's aways a flicker where all the controls are located on the...
8
by: paul.denlinger | last post by:
Hi-- Things have gone well for me on this page design, but when I added a background image, it pushed everything down and messed up my page layout. Before I added the navigation background...
7
by: arupfrancis | last post by:
Hi, I am trying to create a colored box using background images. I am able to do it easily using tables but doing it in divs is proving to be an issue. Moreover IE and Mozilla also seems to be...
16
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of...
10
by: VividWeb | last post by:
Hi. I am relatively new to CSS and HTML but have a basic understanding of most things. One of my backgrounds is not positioning correctly in IE 7 or AOL. The background behind the content...
2
by: thephatp | last post by:
I'm having a problem with IE rendering correctly. I'm experimenting with using all div's in my pages now, and I'm not very familiar with the quirks of IE. I have created a sample page, and I'm...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.