Webmaster Forum



Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-2012, 08:00 AM
Member
Latest Blog:
None

 
Join Date: 05-03-11
Posts: 44
iTrader: 0 / 0%
ernies is liked by many
Formatting Google Adsense ADs

Hello,


I am a bit to HTML and css. I wanted to incorporate a one ad block on the left side of the body part of the page. I'm been thinking about how to format it. Is the best way to create an adssense block just to make a new div id thing on the left side of the page and decrease the width of the body or what? Any suggestions are welcome.


Thanks
Share |
Reply With Quote
  #2 (permalink)  
Old 02-04-2012, 08:18 PM
Member
 
Join Date: 01-29-12
Location: Mexico
Posts: 40
iTrader: 0 / 0%
nikomaster is liked by many
You have to options:

First you can create a main table on the body section and place the ads on the left.
Quote:
<table>
<tr>
<td>Asense</td>
<td>Your site content</td>
</tr></table>
Or you can implement the CSS property float:left in a div tag:
Quote:
<style>
.leftside
{
float:left;
}
</style>
<div class='leftside'>Adsense</div>
__________________
What man is a man if he cannot make a world a better place?
Share |
Reply With Quote
  #3 (permalink)  
Old 02-05-2012, 08:24 AM
Member
Latest Blog:
None

 
Join Date: 05-03-11
Posts: 44
iTrader: 0 / 0%
ernies is liked by many
Thanks, I don't really know tables so well so I will be sure to try the css method.
Share |
Reply With Quote
  #4 (permalink)  
Old 02-05-2012, 08:50 AM
Member
Latest Blog:
None

 
Join Date: 05-03-11
Posts: 44
iTrader: 0 / 0%
ernies is liked by many
I'm still confused about the method, could you possibly give me an example? Here is my code so far.

HTML Code:
<div id="body"> <script type="text/javascript"><!-- google_ad_client = "REMOVED"; /* Wide Skyscraper ADD */ google_ad_slot = "7580633267"; google_ad_width = 160; google_ad_height = 600; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div>
Code:
#body{ border-style:solid; border-width:1px; margin: auto; width: 990px; height:1000px; padding: 5px; }

Last edited by snakeair; 02-05-2012 at 10:13 AM. Reason: removed pub ID for security purpose
Share |
Reply With Quote
  #5 (permalink)  
Old 02-05-2012, 10:41 AM
Member
 
Join Date: 01-29-12
Location: Mexico
Posts: 40
iTrader: 0 / 0%
nikomaster is liked by many
your code is fine, just add the property "float:left" into your "body" CSS code.
I am seeing you are using all available space for your ad. You may want to format the size of the te "div" tag, to a lesser size, such as the size of the ad.

For the rest of the code i.e the content place the "float:right" property to their CSS code.

Example:

Quote:
CSS Code
#ad
{
float:left;
width:120px;
height:600px;
}

#content
{
float:right;
width:520px;
}
And for the HTML
Quote:
<div id="ad">
<Your adsense code>
</div>
<div id="content">
<Any other content>
</div>
Using this example, the ad will be at the left and content at the very right. Also by setting "content" to float:left will also put the code at the right of the ad because the ad code is first.
__________________
What man is a man if he cannot make a world a better place?
Share |
Reply With Quote
  #6 (permalink)  
Old 02-06-2012, 05:05 PM
Member
Latest Blog:
None

 
Join Date: 05-03-11
Posts: 44
iTrader: 0 / 0%
ernies is liked by many
It's almost where I want it to be but the body and content aren't lining up correctly with the header. I want to be side by side in the middle of the page. Do you know how to do this? here is my code.

Code:
#leftad{ float:left; width:120px; height:600px; margin: auto; } #content{ float:right; width:520px; height:600px; border-style:solid; border-width:1px; margin: auto; }
Share |
Reply With Quote
  #7 (permalink)  
Old 02-07-2012, 12:44 PM
Member
 
Join Date: 01-29-12
Location: Mexico
Posts: 40
iTrader: 0 / 0%
nikomaster is liked by many
The header of the site must have the same size of your ad+content. In this way your header would be on top. Also if that does not work you can add the clear:both property to your header section
Code:
#header { width:640px; clear:both; }
Moreover, I recommend containing all section into a main section.
Code:
#main{ width:650px; text-align:left; } #main-content { width:640px; }
Code:
<body> <div id='main' align='center'> <div id='header'> <!-- Site header here --> </div> <div id='main-content'> <div id='leftad'> <!--Ad code here --> </div> <div id='content'> <!-- Content here--> </div> </div> </div> </div> </body>
__________________
What man is a man if he cannot make a world a better place?

Last edited by nikomaster; 02-07-2012 at 12:50 PM. Reason: Code incomplete
Share |
Reply With Quote
  #8 (permalink)  
Old 02-07-2012, 04:28 PM
Member
Latest Blog:
None

 
Join Date: 05-03-11
Posts: 44
iTrader: 0 / 0%
ernies is liked by many
Ok, Thanks, I'll try it out
Share |
Reply With Quote
  #9 (permalink)  
Old 02-07-2012, 04:48 PM
ScriptMan's Avatar
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 7,649
iTrader: 4 / 100%
ScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster materialScriptMan is supreme webmaster material
Quote:
Originally Posted by ernies View Post
Hello,


I am a bit to HTML and css. I wanted to incorporate a one ad block on the left side of the body part of the page. I'm been thinking about how to format it. Is the best way to create an adssense block just to make a new div id thing on the left side of the page and decrease the width of the body or what? Any suggestions are welcome.


Thanks
You did not provide a URL so all I can go is tell you what I do.

I use a 3 col layout where the adsense goes in the right div on most of my sites. The navigation goes in the opposite side and the center width is determined by whatever is left over. The last time I looked most people were still surfing at a little over a 1000px wide. That may have changed by now. 200 for navigation, 170 for adsense and about 550 for the main div is the way I am currently doing it.

When the over whelming majority is surfing at higher resolutions, I will increase the width of the center div. I along with many others feel that supporting the lowest common setting is the best approach.
__________________
SEO does not mean Spam Everywhere Online
Scriptman's Playhouse || Ramblings from an old man
ScriptMan
Share |
Reply With Quote
  #10 (permalink)  
Old 02-08-2012, 06:19 AM
Junior Member
 
Join Date: 02-07-12
Location: United States
Posts: 22
iTrader: 0 / 0%
JumboHoster is liked by somebodyJumboHoster is liked by somebodyJumboHoster is liked by somebody
Send a message via Skype™ to JumboHoster
In the adsense itself when creating the ad you should be able to choose the dimensions there, then you can just input it into your code as the correct size already and not loose any quality from resizing.
Share |
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help With HTML/CSS Formatting? Guerino1 Coding Forum 3 11-27-2010 10:24 AM
Google cached Adsense clicks & new Adsense account michael007 Google Forum 1 10-28-2008 12:43 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:12 AM.
Powered by vBulletin
Copyright © 2000-2011 Jelsoft Enterprises Limited.
Copyright © 2003 - 2011 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.