Forum Moderators: not2easy

Message Too Old, No Replies

Override CSS padding/margins

         

cmendla

4:04 am on May 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello.

I have a situation where I want to put a 160 wide adsense block in a 160 wide colum (using a joomla custom html module - joomla 1.5)

The problem is that the css template is set for a 8 px or so padding. I would like to leave that as-is if possible.

I would thing that I should be able to put a div or style around the adsense code in a way that would move the resulting adsense block 6px back left. That would be perfect for what i need.

IOW,

I would think I could do something like

<div {Margin-left: 0pm}>
Adsense code
</div>

However, after a bit of playing it is obvious I don't have the right syntax. I'm assuming that it would be a margin instead of a padding statement.

The css I am trying to override, I believe is

.BlockContent-body
{
position: relative;
z-index:1;
padding: 8px;
}

I would prefer to do this in the block where I am adding the code and not in the css itself. I realize that might not be optimal but I think it would work better in the long run for me that way

Thanks for any thoughts on this

cg

swa66

6:37 pm on May 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Routes to try:

  • negative margin
    margin: -6px;

  • relative positioning

    position:relative;
    left: -6px;

  • give the parent position (usign position:relative without any left/right/top or bottom) and position you element absolutely inside it
  • ...

cmendla

8:11 pm on May 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Swa66

THANKS!

I found that putting

<div Style="margin-left: -8px" > </div> around the affiliate code works perfectly.

Again, thanks. You saved me a lot of reworking!