SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Location
    Melbourne, Australia
    Posts
    46
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Can you apply a border attribute to <td>?

    I can apply a border to tables, but I'm not managing to apply it to my <td>s. It occurred to me this might not be possible. A google search left me confused (perhaps I didn't use the right terms), can someone set me straight?

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,603
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    The following has always worked for me:

    td {border: 1px solid #000;}
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Mouse catcher silver trophy
    Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,829
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by cheli View Post
    I can apply a border to tables, but I'm not managing to apply it to my <td>s. It occurred to me this might not be possible. A google search left me confused (perhaps I didn't use the right terms), can someone set me straight?
    You can apply borders to table cells, and felgall has given you the code.

    One thing you need to consider is whether you want table cells separated with a gap between the borders (as used to be the default display for tables back in the days before CSS) or whether you want the borders to 'collapse', ie a single border separating adjacent cells.


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
  •