PDA

View Full Version : newbie needs help with css division formatting



gibsongk55
Jul 20th, 2009, 05:04 PM
Hi,

I have an image in a division and i want another division with google adsense to appear to the right of the image inline.

Here is what i have in the html portion:


<div id="body-i">
<h2 id="hspecials">
<img src="images/title_menus.gif" alt="Our Special Menus" width="291" height="32" /></h2>
<div id="specials" style="width: 270px; height: auto">
<img src="images/body.gif" alt="Coffee & Smoothies Bangkok" width="526" height="277" /></h2>
<!-- end specials -->
<!-- end events -->
<h2 id="hevents1"><div style="width:227px; height:177px; float:right; position:relative;">

Adsense code here

</h2>
</div>
</div><!-- end body -->
<div class="clear" id="spacer"></div>


In the css style sheet for these two divisions i have:


#body #specials {
float: left;
width: 286px;
margin-left: 2px;
display: inline;
}


#body #hevents {
position: absolute;
top: 0; left: 284px;
}

* html #body #hevents {
position: relative;
top: 0; left: 0;
margin-top: -32px;
}
#body #hevents1 {
position: absolute;
top: 2; left: 530px;
}

* html #body #hevents1 {
position: relative;
top: 0; left: 0;
margin-top: -32px;
}


Here you can see what it is doing --> http://www.chokicafe.com/index-wg.htm

Thanks for any help you can give me.

Gibs

effpeetee
Jul 20th, 2009, 05:08 PM
You have no Doctype at the head of your page (http://www.w3.org/QA/2002/04/valid-dtd-list.html).
You can't control the page properly without a Doctype.

You also have some errors to correct here (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.chokicafe.com%2Findex-wg.htm&charset=%28detect+automatically%29&doctype=Inline&group=0).

Also one here.
205 #body #hevents1 Value Error : top only 0 can be a length. You must put a unit after your number : 2


Frank

gibsongk55
Jul 20th, 2009, 06:32 PM
okay i made a few fixes but i think that online validator does not help very much. Things such as fonts in which my editor program inserts for cannot be wrong. Many of these errors are ok. As far as errors for the division tags that have to do with css... well i don't know what to do with them. That is why I am asking for help. I still need some help.

Thanks,

Gibs

drhowarddrfine
Jul 20th, 2009, 09:00 PM
okay i made a few fixes but i think that online validator does not help very much. Things such as fonts in which my editor program inserts for cannot be wrong.That validator is by the W3C who are the store keepers of HTML. Follow it carefully. Your editor is wrong if it uses <font> in that way and old for using it at all since font was deprecated years ago.
Many of these errors are ok.There is no such thing as an ok error. You can't count on errors to be handled the same everywhere by all browsers all the time both now and in the future.

jerry62704
Jul 20th, 2009, 09:32 PM
Hi,

I have an image in a division and i want another division with google adsense to appear to the right of the image inline.

Here is what i have in the html portion:


<div id="body-i">
<h2 id="hspecials">
<img src="images/title_menus.gif" alt="Our Special Menus" width="291" height="32" /></h2>
<div id="specials" style="width: 270px; height: auto">
<img src="images/body.gif" alt="Coffee & Smoothies Bangkok" width="526" height="277" /></h2>
<!-- end specials -->
<!-- end events -->
<h2 id="hevents1"><div style="width:227px; height:177px; float:right; position:relative;">

Adsense code here

</h2>
</div>
</div><!-- end body -->
<div class="clear" id="spacer"></div>


In the css style sheet for these two divisions i have:



Here you can see what it is doing --> http://www.chokicafe.com/index-wg.htm

Thanks for any help you can give me.

Gibs

You have a close <h2> with no open for it (in red). Why do you want the ad stuff in an <h2> tag? The purpose of heading tags is for heading.

In your css, you have "#body #hevents". There is no "body" id shown in your code. Further, if it is an id (#), then it is unique and there is no need to have something that is unique delineated twice. "#hevents" is just as unique as "#body #hevents" and is less confusing.

gibsongk55
Jul 21st, 2009, 03:34 AM
Hi,

okay i got it down from over 50 to just 9 errors. That's as far as I could get. Still cannot fix what i originally needed. I remind you that I am totally new to css. I am very confused about it. Can anyone help me with these errors and get the ad positioned right? Also with some of the error correction my resource link on the bottom of the page is too small and will not center even though i added the information in the css file under "footer".

Thanks,

Gibs