How To Add Padding To This Div?

6 replies
  • WEB DESIGN
  • |
I'm trying to add padding to an add I've placed on my site using a plugin called wp-insert.

This is what I've tried but it's not working:

<div style="float:left"; padding: 10px;> Ad Code Here </div>

I want the add to be at the top of my post, left aligned, with the post text to the right. The post text is wrapped properly, but the no padding.

Any ideas?
#add #div #padding
  • Profile picture of the author kingjpm
    Try

    HTML Code:
    <div style="float:left; padding: 10px !important;"> Ad Code Here </div>
    Signature
    RogueDen.com
    {{ DiscussionBoard.errors[9290408].message }}
    • Profile picture of the author Krishna876
      This worked! One more question though...

      This adds 10px padding all around the ad. So it pushes the ad down 10px as well.

      Is there any way to just add 10px to the right of the ad (between the ad and post text)?

      Originally Posted by kingjpm View Post

      Try

      HTML Code:
      <div style="float:left; padding: 10px !important;"> Ad Code Here </div>
      {{ DiscussionBoard.errors[9290703].message }}
  • Profile picture of the author brayk
    Originally Posted by Krishna876 View Post

    <div style="float:left"; padding: 10px;> Ad Code Here </div>
    I'm going to assume that the misplaced quote to the right of "left" is a typo.

    Past that, and if kingjpm's suggestion doesn't work, then you're running into a very common issue of padding/margins not working on floated divs inside of non floating containers. Check out this link for reference.

    html - css float and padding - Stack Overflow

    You may need to restructure your page or float your containing element, if that doesn't mess up the layout of your page.
    {{ DiscussionBoard.errors[9290616].message }}
  • Profile picture of the author harkon
    Use margin-right.
    {{ DiscussionBoard.errors[9290875].message }}
    • Profile picture of the author LarryKeenan
      HTML Code:
      <div style="float:left; padding-left:10px; padding-right:10px;  !important;"> Ad Code Here </div>
      {{ DiscussionBoard.errors[9290908].message }}
  • Profile picture of the author Veeramanikandan
    you are putting the double quotes in wrong place.
    <div style="float:left"; padding: 10px;> Ad Code Here </div>

    The double quotes will come starting and end of the style properties. That is given Below:
    <div style="float:left; padding: 10px;"> Ad Code Here </div>

    Now the padding will working properly.
    {{ DiscussionBoard.errors[9346142].message }}

Trending Topics