Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. CSS Tables - Simple question

CSS Tables - Simple question

Scheduled Pinned Locked Moved Web Development
cssquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peter Mayhew
    wrote on last edited by
    #1

    Ok, this is quite a simple question. I'm changing my website to use CSS. And i thought hey, how about allowing the CSS to control my tables as well. So if we have a table, which the code looks like:

    and we want to apply the CSS style to it. Do i have to create a style for everything, hence Table, tr and td. Because that is what i am doing, and it seams a little tedious.. hence it becomes

    Is there a simplier way, so I don't have to apply the class to literally everything seperately :confused: --- Peter M

    U M 2 Replies Last reply
    0
    • P Peter Mayhew

      Ok, this is quite a simple question. I'm changing my website to use CSS. And i thought hey, how about allowing the CSS to control my tables as well. So if we have a table, which the code looks like:

      and we want to apply the CSS style to it. Do i have to create a style for everything, hence Table, tr and td. Because that is what i am doing, and it seams a little tedious.. hence it becomes

      Is there a simplier way, so I don't have to apply the class to literally everything seperately :confused: --- Peter M

      U Offline
      U Offline
      User 1200622
      wrote on last edited by
      #2

      Yes. When you specify that will work for your entire table. But when you want to use a different style for some cells you will have to specify

      tag in your style sheet. Then every

      would take that style. like: td { color: #FF0000; } And yes this was a really simple question, CAUSE I WAS ABLE TO ANSWER IT. Any tool is only as good as you can use it!! (http://www.pascalnet.tk)

      1 Reply Last reply
      0
      • P Peter Mayhew

        Ok, this is quite a simple question. I'm changing my website to use CSS. And i thought hey, how about allowing the CSS to control my tables as well. So if we have a table, which the code looks like:

        and we want to apply the CSS style to it. Do i have to create a style for everything, hence Table, tr and td. Because that is what i am doing, and it seams a little tedious.. hence it becomes

        Is there a simplier way, so I don't have to apply the class to literally everything seperately :confused: --- Peter M

        M Offline
        M Offline
        mysorian
        wrote on last edited by
        #3

        Peter: You can apply style to a table as a whole, or to the rows, or to the cells. If you use the html attributes, you can individually apply style how you want. If you are using css styles then rules such as these: table{} tr{} td{} apply styles that apply to the whole table, all rows, and all cells. If you want to have independent control you may use as shown in the next block of formatting: [cut and paste:-O in notepade and save with htm or html extension and open it in IE or Netscape.. ------------------- table{background-color:gold} .firstrow{background-color:pink} .lastcell{background-color:magenta}

        Jay

        Krish

        Mysorian

        India

        ----------------------

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups