Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] css negative padding

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #40496
    Manojnaanak
    Participant

    please tell me anyone.

    can we give padding in menus?

    example:
    {
    padding-left:-15px;
    }

    is this proper way or not???

    thanx in advance

    #112805
    Paulie_D
    Member

    Certainly you can use padding in menus but there really isn’t any such thing as ‘negative’ padding.

    You could use negative margins but there generally isn’t really a good reason to. Properly structured HTML and logical CSS will accomplish your design without using any odd ‘clever’ hacks.

    #112813
    Manojnaanak
    Participant

    sometime in joomla and wordpress default template used our custm design

    #112815
    Senff
    Participant

    Negative padding: absolute NO. Not valid, isn’t logical, makes no sense, etc.

    Negative margin: generally not needed but there are situations where it’s really useful (I disagree with @Paulie_D — I definitely don’t think it’s a ‘hack’ to use negative margins).

    #112824
    Taufik Nurrohman
    Participant

    People create the ‘box out effect’ with a negative margin.

    #112825
    Senff
    Participant

    Of course somewhat outdated, but still a good article in defense of negative margins: http://coding.smashingmagazine.com/2009/07/27/the-definitive-guide-to-using-negative-margins/

    #112832
    Paulie_D
    Member

    Sorry…I didn’t mean to imply that one should never use negative margins….only that using them to ‘fix’ a problem is generally bad.

    Using them to position an object because the design calls for it is, of course, entirely reasonable.

    #112845
    Senff
    Participant

    @PaulieD I wasn’t calling you out, sorry if it sounded like that! Just don’t think it qualifies as a ‘hack’. But it does have this stigma of “bad practice” anyway, so it’s all good. :)

    #169863
    jgodek
    Participant

    There is a case for negative padding. I want an border framed around a div. This border is a styled image to create a frame design around the div. I need the container div to appear to be inside the parent div so the parent divs border frames it. I can’t use negative margins since the container div is above the parent div in the DOM. So negative padding would be great here.

    #169870
    Paulie_D
    Member

    Negative padding here doesn’t sound like a solution, a extra div or border-image sounds like a better option.

    #169873
    jgodek
    Participant

    It seems border image doesn’t frame a div it just creates a border around it.
    I had this post made last week. It shows basically what Im tying to do.

    Post on CSS tricks

    #169876
    Paulie_D
    Member

    OK, but negative padding is NOT going to achieve that look..a proper border-image could but it would be somewhat inflexible as it would require an image with a background the same as your background color so it would blend in.

    With a slider…it would probably be even worse.

    #169877
    jgodek
    Participant

    Yeah Im thinking to achieve this may not be worth the hassle.
    Might b easier to do just add a frame to the images inside the slider. Thanks for your help.

    #238356
    kenmwebaze
    Participant

    Okay, You are right. However, in cases where you inherit another designer’s style sheet, you may need a quick stitch and find the need to apply a negative margin especially if you wish to hide the already curved image edges whose write up you don’t wish to revisit.

    I applied it my self in the line that follows;
    .ptnx{ padding-left:15px; padding-right:15px; padding-bottom:0; padding-top:0px; margin-top:-1px; auto; color:#444; }

    #261454

    no, but you can use as margin….

    {
    margin-left:-100px;
    }

Viewing 15 posts - 1 through 15 (of 15 total)
  • The forum ‘CSS’ is closed to new topics and replies.