SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

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

  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,351
    Mentioned
    12 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
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    19,992
    Mentioned
    217 Post(s)
    Tagged
    2 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
    SitePoint Award Recipient Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    37,781
    Mentioned
    99 Post(s)
    Tagged
    3 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,351
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Ya thats what i figured. Ok thanks guys.

  5. #5
    padawan silver trophy
    SitePoint Award Recipient markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,015
    Mentioned
    25 Post(s)
    Tagged
    0 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
  •