Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Align 125x125 ads ?

    Hello, I'm making a blog on which I want to put 125x125 ads.
    I'm facing a problem tho, I want my 4 ads to be like this:


    And what I get is this :


    With the following code :
    Code:
    <script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><p style="padding:0;margin:0;line-height:12px;font-size:10px;width:125px;text-align:center;color:#2AB8E7;"><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p>
     
    <script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><p style="padding:0;margin:0;line-height:12px;font-size:10px;width:125px;text-align:center;color:#2AB8E7;"><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p>
     
    <script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><p style="padding:0;margin:0;line-height:12px;font-size:10px;width:125px;text-align:center;color:#2AB8E7;"><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p>
     
    <script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><p style="padding:0;margin:0;line-height:12px;font-size:10px;width:125px;text-align:center;color:#2AB8E7;"><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p>

    How can I do it ?
    Thanks !

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,668
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello okkzz,
    Using floats is how you put thing beside each other. The natural flow of a float is to drop to the next line when there is not enough room for it. By putting the 4 floats in a container and specifying a width that is wide enough for 2 of them (plus their margins) you can make your 4 ads form a square.

    Try it like this:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    html, body {background: #000;}
    #wrapper {
    	width: 270px;
    	margin: 50px auto;
    	overflow: auto; /*to clear the floats*/
    	background: #ff0; /*a bg color for demonstration only*/
    }
    p {
    	width: 125px;
    	margin: 5px;
    	padding: 0;
    	float: left;
    	line-height: 12px;
    	font-size: 10px;
    	text-align: center;
    	color: #2AB8E7;
    }
    </style>
    </head>
    <body>
        <div id="wrapper">
    		<p><script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p> 
            <p><script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p> 
            <p><script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p> 
            <p><script type="text/javascript" charset="utf-8" src="http://ads.advertisespace.com/AA/Jf/qG.js"></script><a href="http://www.advertisespace.com/?a=AAFcJL" style="color:#2AB8E7;">Advertising Online</a></p>
        <!--end wrapper--></div>
    </body>
    </html>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a lot it's working like a charm

    Sorry for this noobish question, I'm using a blogger template, and trying hard to make a nice blog but it's complicated as I have no clue about coding

    So thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •