1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

remove padding from element

Discussion in 'CSS' started by cag8f, May 10, 2014.

  1. #1
    Hi All. I'm trying to edit my CSS to remove the top padding from a particular element on my page. After inspecting the culprit element (using Chrome-->Inspect Element), I see that it has a class of .content-area and a top-padding of 72px. Here is the relevant CSS info yielded by inspect element:

    .content-area, .content-sidebar {
    padding-top: 72px;
    }

    However, when I insert the following into my style.css:

    .content-area{
    padding-top: 0px;
    }

    the padding remains. Any thoughts on what I'm doing wrong, or how to resolve?
     
    cag8f, May 10, 2014 IP
  2. cag8f

    cag8f Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Nevermind. I think I need to investigate media queries some more (the culprit css is enclosed in a media query).
     
    cag8f, May 10, 2014 IP
  3. xXxpert

    xXxpert Well-Known Member

    Messages:
    604
    Likes Received:
    34
    Best Answers:
    9
    Trophy Points:
    165
    Digital Goods:
    7
    #3
    Or You can use !important to force new value
    eg : padding-top: 0 !important;
     
    xXxpert, May 11, 2014 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    From Mozilla Developers' Network:
    I wouldn't even allow that much slack. Just never ever, period.

    cheers,

    gary
     
    kk5st, May 11, 2014 IP
    deathshadow likes this.
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #5
    IF what's decalared is EXACTLY this:

    .content-area, .content-sidebar {
    padding-top: 72px;
    }

    Why not just change it to this?

    .content-sidebar {
    padding-top: 72px;
    }

    If you don't want content-area doing it?
     
    deathshadow, May 16, 2014 IP
  6. h2theme

    h2theme Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #6
    Replace to this:
    .content-area{
    padding-top: 0px !important;
    }

    www.h2theme.com
     
    h2theme, May 16, 2014 IP
  7. howarddavidson

    howarddavidson Greenhorn

    Messages:
    43
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    8
    #7
    That exactly what I was thinking of, Deathshadow, the:

    .content-area{
    Padding-top: 0px;
    }

    Should work just fine, but I’m guessing that Cag8f never removed it from the first selector, so like Deathshadow said just remover the “.content-area” from the selector.
     
    howarddavidson, May 17, 2014 IP
    deathshadow likes this.
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #8
    It's kind-of why I was laughing at the other respondents -- who all seem to think "throwing more code at it" and dicking around with crap like !important instead of simply removing the offending selector.

    Seems to be the mentality everyone has about everything right now, there's a problem just throw more code at it and blindly hope it works. ESPECIALLY when the easiest answer is to actually remove code instead. :(
     
    deathshadow, May 17, 2014 IP
  9. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #9
    I MOSTLY agree with you -- and the "usage cases" in the part you quoted just prove what crap Frameworks like YUI or ExtJS are, as they might FORCE you to use it.

    BUT, there is ONE place it's invaluable -- client side user.css to override crappy garbage CSS that 'designers' who know jack **** about accessibility vomit up and call a website, that as a visitor you pretty much have to override to even use the site.

    See the user.css I have Opera (or FF's userContent.css) for websites where the dipshit know-nothing PSD jockey style designer crapped out PX metric fonts with goofy illegible webfonts. (aka the majority of vBull, phpBB and Xenforo skins)

    * { font-size:100% !important; line-height:150% !important; font-family:arial,helvetica,sans-serif !important; }
    body { font-size:85% !important; line-height:150% !important; }
    code, pre, tt { font-family:consolas,monospace !important; }
    Code (markup):
    When using user.css in your browser to bend poorly written websites over your knee and make them accessible, !important is the yard long wood paddle with the word "redemption" burned into it.

    But yeah, using it in a website's CSS? that's most likely just bad code and poor planning.
     
    deathshadow, May 17, 2014 IP
  10. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #10
    Agreed. The author has no business nor need to ever use the !important whatsit. If he does, he's already screwed the pooch.

    The user does.

    cheers,

    gary
     
    kk5st, May 17, 2014 IP