Results 1 to 6 of 6

Thread: Problem with color attribute in CSS

  1. #1
    Join Date
    Dec 2009
    Posts
    42

    Problem with color attribute in CSS

    I have just started to learn the CSS in html because i find that there is no point falling behind the current web 2.0 Generation. I got messed up with the code or with the color attribute. what i want is that in my code pnl.cs3 should have small caps but because i messed up with the code i am getting red color instead of the aqua. Please help me to get rid of this css color problem.


    Code:
    <html>
    <head>
    <style type="text/css">
    body {background-color: yellow;}
    body {color:red}
    h1 {color:#00ff00}
    pnl.cs1 {color:rgb(0,0,255)}
    pnl.cs2 {color:000000}
    pnl.cs3
    {
    color:0fffff,font-variant:small-caps
    }
    </style>
    </head>
    <body>
    <h1>This is my heading</h1>
    <p>This is a regular paragraph. The default text should be red. This is defined in the body section of my css</p>
    <p class="cs1">This is a paragraph with class="ex". This text is blue.</p>
    <p class="cs2" class="small">This is a second paragraph with a class. This text should be black because i entered 000000</p>
    <p class="cs3">This is my 3rd paragraph with a class of 3. This text should be aqua blue</p>
    </body>
    </html>

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Problem with color attribute in CSS

    Seems you don't know the concept of RGB in the html which you need to know if you want to play with colors in html. The html is quite a good and easy language that can be learned very easily. i think that you must check the validity of the css from the css validator online. Try to adjust the color by changing the RGB value in your code.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Problem with color attribute in CSS

    In the above code i think that there are three errors. You are using color 0 which is not a valid color value in the pnl.cs2. The color 0fffff is an unknown dimension and lastly add a ;(semi-colon) after the color attribute because it attempts find a semi-colon before the property name. After fixing these errors i think that you will get the desired output.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Problem with color attribute in CSS

    Whenever you specify a hex color you shoul use the # sign for example color:#0fffff. i think that your third paragraph does not display as you expect is because instead of a comma, you should have a semicolon(: )

    This is your code
    pnl.cs3
    {
    color:0fffff,font-variant:small-caps
    }
    Which should be like this
    pnl.cs3
    {
    color:0fffff;font-variant:small-caps
    }

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Problem with color attribute in CSS

    Since you are new to html language i think that's why you have made a mistake because you have implemented the program correctly but you made a syntactical mistake change the code within the pnl.cs3 as you see it below

    pnl.cs3
    {
    color:#0ffffff;
    font-variant:small-caps
    }

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Problem with color attribute in CSS

    Although you have just started to learn the html language but you have wrote the program correctly you just made some mistakes in terms syntax only. check your code with that of mine you have forgotten the '#' which should be included before the color variant


    Code:
    pnl.cs3 {
      color: #0fffff;
      font-variant: small-caps;
    }

Similar Threads

  1. Puzzling PC to LCD TV color loss problem
    By NewComer in forum Hardware Peripherals
    Replies: 4
    Last Post: 13-04-2010, 05:30 AM
  2. Panasonic TH-42PZ80U color problem?
    By Cammaron in forum Monitor & Video Cards
    Replies: 3
    Last Post: 01-08-2009, 12:53 PM
  3. Problem with cells color VB
    By Manhamanha in forum Software Development
    Replies: 5
    Last Post: 03-06-2009, 06:04 PM
  4. IE has a problem with the href attribute
    By GunFighter in forum Software Development
    Replies: 3
    Last Post: 15-04-2009, 10:24 AM
  5. Problem with color pictures.
    By Dietrich in forum Monitor & Video Cards
    Replies: 3
    Last Post: 17-02-2009, 10:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,119,340.46762 seconds with 17 queries