SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2011
    Location
    Karachi
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML for boxes side by side

    I want to put two adsense boxes before my content in such a way that both boxes appear together. Like on this page.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,606
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    They haven't done that very well. Firstly, they use outdated code to make that happen, and I don't see the point, as it just repeats the ads!

    Anyhow, if you really want to do this, create two divs, give them a width a bit less than half the width of the content area, set them to float: left; or display: inline-block; and then paste the Google code inside each of them.

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2011
    Location
    Karachi
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    They haven't done that very well. Firstly, they use outdated code to make that happen, and I don't see the point, as it just repeats the ads!

    Anyhow, if you really want to do this, create two divs, give them a width a bit less than half the width of the content area, set them to float: left; or display: inline-block; and then paste the Google code inside each of them.
    My site is on wordpress and I'm using following code to wrap my content around adsense box.
    <div style="float: left; margin: 3px 3px 3px 3px;"> code</div>
    I put two divs, one with left and other with right but not getting what I want. Can you guide a little bit more?

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,606
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    It's better to put the styles in your external style sheet, but I'll put them inline here for demo porpoises. You need to give the boxes a width or floating won't do anything. Ideally, we should see your page (or some demo code) to know what circumstances you're working within (fixed width wrapper? etc.), but here's a possible way to go:

    Code:
    <div style="float: left; margin: 2%; width: 40%;"> code</div>
    If your content area has a fixed width, you could change the width and margins to pixels, but mixing pixels and % is a bit hit and miss.

  5. #5
    SitePoint Zealot
    Join Date
    Sep 2011
    Location
    Karachi
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My site is ceramic tiles.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,606
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    OK, try changing the styles on that container div to:

    Code:
    <div style="float: left; margin: 3px 10px 3px 3px; width: 330px;"> </div>
    and then duplicate it so that there are two.

  7. #7
    SitePoint Zealot
    Join Date
    Sep 2011
    Location
    Karachi
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    OK, try changing the styles on that container div to:

    Code:
    <div style="float: left; margin: 3px 10px 3px 3px; width: 330px;"> </div>
    and then duplicate it so that there are two.
    You are great mate!
    Thank you very much. its done finally.
    How do you know so much about CSS and html. Have you learned it specially or just on interent?

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,606
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    Quote Originally Posted by opportunist86 View Post
    How do you know so much about CSS and html. Have you learned it specially or just on interent?
    Just from books, hanging around here, and practice. But I don't know much really ...

    Glad to help, anyhow.


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
  •