1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

CSS Inserting tables

Discussion in 'Web Development' started by purplesp8y, Dec 2, 2010.

  1. purplesp8y

    purplesp8y New Member

    I'm new to using CSS and not sure how to embed a table into my webpage. I can put the html code straight into the html but it doesn't look right when I view it, very small and not aligned across the page.

    So what is the best way to put a table into charity template using CSS?
     
  2. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Hang in there purplesp8y we have a few members like enigma1 and Geoff Tyrer who are great at these types of questions. I'm sure when someone who knows the answer comes on the board you'll get it solved.
     
  3. purplesp8y

    purplesp8y New Member

    I've had a play at it and this was the code I used in css which is basic but is all I'm after. How do I get internal black lines and any suggestions on better looking table

    table {
    border-collapse:collapse;
    border:2px solid black;
    width:100%
    }
    th {
    height:50px;

    }
    td {
    text-align:left;
    height:50px;
    vertical-align:top;
    padding:15px;
    }
     
  4. enigma1

    enigma1 New Member

    Remove the border: 2px black from the table and put in the table cell. This should take care of both internal and external borders because you have the border-collapse in the table tag.

    td {
    text-align:left;
    height:50px;
    vertical-align:top;
    padding:15px;
    border:2px solid black;
    }

    If you need it in the th cell add it there too. You will need a container for the table so the change won't affect any other tables you may use. Something like:

    Code:
    #table_container table {
     border-collapse:collapse;
     width:100%
    }
     
    #table_container table th {
     height:50px;
     }
     
    #table_container table td {
     text-align:left;
     height:50px;
     vertical-align:top;
     padding:15px;
    border:2px solid black;
    }
    
     
  5. purplesp8y

    purplesp8y New Member

    Thank you, I was so close. It's exactly how I want it.