Results 1 to 4 of 4

Thread: How to apply color to the table row rather then each cells

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow How to apply color to the table row rather then each cells

    Hi i want to use single <tr style="background: #FFB951;"> at start of html block for the following blocks of code but i do not know how to modify it so it does not disable the hyperlinks .In another word i want the color is applied to the table row rather than every individual cell.
    Also i want to remove the underline for hyperlink.I be happy if some one help thanks

    just like this :


    PHP Code:
    <tr>
            <td width="5%" bgcolor="#C0C0C0"><? echo $numbers; ?>&nbsp;</td>
            <td width="35%" bgcolor="#C0C0C0"><a
            href="albums.php?albumname=<?=strval$row['artist'] );?>"><b><?=strval$row['artist'] );?></b>
            &nbsp;</a> </td>
            <td width="10%" bgcolor="#C0C0C0">467&nbsp;</td>
    </tr>
    second html

    PHP Code:
    <tr>
            <td bgcolor="#C0C0C0"><? echo $numbers; ?>&nbsp;</td>
            <td bgcolor="#C0C0C0"><a
            href="./albumsongs.php?albumname=<?=strval$row['album'] );?>&artistname=<?=strval$row['artist'] );?>"><?=strval$row['album'] );?></a>&nbsp;</td>
            <td bgcolor="#C0C0C0"><a
            href="albums.php?albumname=<?=strval$row['artist'] );?>"><?=strval$row['artist'] );?></a> </td>
            <td bgcolor="#C0C0C0">276&nbsp;</td>
        </tr>

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: How to apply color to the table row rather then each cells

    Use CSS - this is a lot easier than applying the colors in the HTML and it also keeps the visual formatting separate from the data:
    Code:
    <style type="text/css">
      #mytable {
        width: 50%;
      }
    
      #mytable td {
        background-color: #C0C0C0;
      }
    
      #mytable .col1 {
        width: 10%;
      }
    
      #mytable .col2 {
        width: 70%;
      }
    
      #mytable .col3 {
        width: 20%;
      }
    </style>
    </head>
    <body>
      <table id="mytable">
    <tr>
            <td class="col1"><? echo $numbers; ?>&nbsp;</td>
            <td class="col2"><a
            href="albums.php?albumname=<?=strval( $row['artist'] );?>"><b><?=strval( $row['artist'] );?></b>
            &nbsp;</a> </td>
            <td class="col3">467&nbsp;</td>
    </tr> 
      </table>
    </body>
    </html>
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to apply color to the table row rather then each cells

    well if i use style then i can not make the each line diffrent color!! can i ? how?

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to apply color to the table row rather then each cells


Posting Permissions

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



Click Here to Expand Forum to Full Width