SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do you put borders around just one cell ?

    How do you get just one cell in the middle of a table to have a thick border around all sides of it please ? Have Googled it, but can't seem find out how ?

  2. #2
    SitePoint Zealot coothead's Avatar
    Join Date
    Jan 2005
    Location
    Chertsey, London, England
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there Dez,

    give the td element an id ...
    Code:
    <td id="foo">
    ..then set your required CSS...
    Code:
    
    <style type="text/css">
    #foo {
        border:4px solid #f00;
     }
    </style>
    
    coothead

  3. #3
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks coothead, it's appreciated, how would you do a collapse border, using the same idea please ?

  4. #4
    SitePoint Zealot coothead's Avatar
    Join Date
    Jan 2005
    Location
    Chertsey, London, England
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there Dez,

    use...
    Code:
    
    table {
        border-collapse:collapse;
     }
    
    coothead

  5. #5
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks coothead, but it's just for the one cell.

  6. #6
    SitePoint Zealot coothead's Avatar
    Join Date
    Jan 2005
    Location
    Chertsey, London, England
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there Dez,

    as far as I know, which isn't a great deal, it's all or nothing.

    coothead

  7. #7
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    You can't collapse the border of just one cell in a table. This wouldn't be possible, the way HTML tables are structured. Unless you need the border to flush with the other borders in the table, it shouldn't matter though, the border is applied to just that one cell.

    Otherwise, post a picture of how you'd like it to look.
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  8. #8
    SitePoint Zealot materialdesigner's Avatar
    Join Date
    Dec 2010
    Location
    Ithaca, NY
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you mean how do you remove the border from that one cell now that it has one?
    Code CSS:
    #foo {
      border-width: 0;
    }


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
  •