SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Any way to say this in css3 for modern browsers ie8+ ?

    I need to say my h1 has 1.8em bottom margin. But if it has #date id directly after the h1 has bottom margin zero? And instead the #date has the bottom margin of 1.8em? I'm strongly guessing a big fat no but thought I'd ask - maybe some css3 thing.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,173
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    An easy solution might be to target a #date element that follows an h1 with

    h1 + #date {}

    and then give the date element a bottom margin and a negative top margin to pull it up.

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,352
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    I'd do it the way Ralph suggests because as yet there is no parent selector in CSS.

  4. #4
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Ya thats what i figured. Ok thanks guys.

  5. #5
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Paul O'B View Post
    as yet there is no parent selector in CSS.
    Or previous sibling.. Lea Verou said there's something in Selectors4 for that, but whether browsers will implement it is another story. Devs can help by pushing it.


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
  •