SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru MikeBigg's Avatar
    Join Date
    Jun 2004
    Location
    Reading, UK
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Styling a <h2> tag.

    In the page I have linked to below, I would like the table captions to use the <h2> tag. However, when I use the h2 tag, I get what appears to be a line break at the end, which causes space underneath the text.

    The top table demonstrates this with the left hand caption having a <h2>.

    The bottom table is what I would like the table to look like (preferably with the text in bold, but that is a separate issue).

    Example page .

    Thanks,

    Mike

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I first thought you meant nesting an <h2> inside a <caption>, which is invalid, but I see you just want to put an <h2> inside a <td>.

    Try this:
    Code:
    td h2 {
      margin:0;
      padding:0;
    }
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Guru MikeBigg's Avatar
    Join Date
    Jun 2004
    Location
    Reading, UK
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect. Thanks.

    Mike

  4. #4
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd start off with the following in the stylesheet so you don't have to remove the padding and margin from all the individual elements though, otherwise you'll have to do the same thing for all your headings etc.

    Code:
    * {
    	padding: 0px;
    	margin: 0px;
    }

  5. #5
    SitePoint Guru MikeBigg's Avatar
    Join Date
    Jun 2004
    Location
    Reading, UK
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that advice. I saw you post that in another thread and have taken it onboard already.

    The page I'm doing is actually very simple and won't need that, but I have noted it for the future.

    Thanks,

    Mike

  6. #6
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As was pointed out in the other thread though this will remove it from everything so expect some unexpected results especially with lists but I find it a big advantage just having to correct list items than having to remove padding from everything


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
  •