Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    attribute selector aka [att=val] css

    ive been straining my brain for the past 6 hours trying variation after variation of this code.

    i even broke it down as simple as i could get it, taking the parts onto a new page and trying just the one css line, and the one element tree.

    no matter how i try to work on this, the only way anything happens is if i take out the [width] component of the selector.

    Code:
    <html>
    
    <head>
    
    <title>New Page 1</title>
    <style type="text/css">
    table{ background-color: red }
    </style>
    </head>
    
    <body>
    <table width=800>hi </Table> <table width=700> hi2 </table>
    </body>
    
    </html>
    this produces 2 red tables, of two diffrent widths, both with text inside.

    Code:
    <html>
    
    <head>
    
    <title>New Page 1</title>
    <style type="text/css">
    table[width]{ background-color: red }
    </style>
    </head>
    
    <body>
    <table width=800>hi </Table> <table width=700> hi2 </table>
    </body>
    
    </html>
    this produces the word hi2 under the word hi, both on the left end of the screen.

    i am extremely confused. w3.org gives examples of how to use this, and i obviously am having trouble.

    i already checked that nothing was wrong with my version of frontpage. i copied the desired code into notepad, attempted it at someone elses house. im just lost.

    can someone please explain the correct format?

  • #2
    New Coder
    Join Date
    Dec 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You never said what you'tr trying to do. What is it exactly you are trying to do? The only thing I would think you are trying to do is get the content inside the tables. If so, you need a table row as well as a table data tag. The [width] part confuses me because there is no reason to have that. Here is what I am guessing you're trying to do:

    Code:
    <html>
    
    <head>
    
    <title>New Page 1</title>
    <style type="text/css">
    table
    { 
    background-color: red 
    }
    </style>
    </head>
    
    <body>
    <table width="800">
    <tr>
    <td>
    hi
    </tr>
    </td> 
    </table> 
    
    <table width="700">
    <tr>
    <td>
    hi2 
    </tr>
    </td>
    </table>
    
    </body>
    </html>
    Last edited by cronic5; 01-03-2006 at 06:30 AM.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    It looks like you are trying to find all tables that have the width attribute but in order for this to work you need to give it a value as well but honestly I wouldn't even bother with this yet. IE6 currently doesn't support what you are trying to do.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •