making text / image boxes in HTML
Page 1 of 1
Steve-O 2004




Posts: 2851

PostPosted: Sun, 25th Mar 2012 18:01    Post subject: making text / image boxes in HTML
Just wondering how to align text / image boxes in HTML?

So far I have done -

Code:

<div class=textbox style=" float: left;
                  margin-top: 15px;
                  margin-left: 35px;
                  width: 410px;
                  height: auto;
                  background-color: red;">
                  
                                                <p> Test </p>
                  <p></p>
                  <p></p>
               
                  
                  

</div>

<div class=ad1 style="float: right;
                  margin-top: 15px;
                                      margin-right: 35px;
                  width: 300px;
                       height: 240px;
                                       background-color: blue;">
                  
                                                <p> Test </p>
                  <p></p>
                  <p></p>
                  
                  
                  

</div>

<div class=ad2 style=" float: right;
                   margin-right: 35px;
                                       margin-top:15px;
                                       width: 300px;
                        height: 120px;
                   background-color: black;" >

                  <p> Test</p>
                  <p></p>
                  <p></p>
                  
                  
               
                       
</div>


What I want is for textbox to be on the left and ad1 and ad2 to be on the right with ad1 ontop, a gap of 15px and then ad2 below it but I cant work it out!!

The problem Im having is ad2 wont go below ad1!! its like its using that as the margin as well and not the page body as the margin? ad2 keeps going under "textbox"





anyone know what Im doing wrong? Should I have them in the CSS or can I leave them in the html?

Thanks


George W Bush -

'...more and more of our imports are coming from overseas.'
Back to top
Steve-O 2004




Posts: 2851

PostPosted: Sun, 25th Mar 2012 18:55    Post subject:
ok, Ive sorted it with -


Code:


<div class=ad2 style=" float: right;
                   margin-right: -300px;
                    margin-top: 270px;
                     width: 300px;
                       height: 120px;
                   background-color: black;" >

                  <p> Test</p>
                  <p></p>
                  <p></p>
                 
                 
               
                       
</div>


Is that ok or is this not the right way to do it?? Seems to be working fine

Thanks


George W Bush -

'...more and more of our imports are coming from overseas.'
Back to top
shole




Posts: 3363

PostPosted: Mon, 26th Mar 2012 00:30    Post subject:
well, it's much clearer to have them in a separate <style> section, and is considered good convention.
also, quote the tag classes and ids.
and ids should be used for unique individual elements and classes to control multiple elements at once.

on positioning, found this really useful;
http://www.barelyfitz.com/screencast/html-training/css/positioning/
Back to top
Werelds
Special Little Man



Posts: 15098
Location: 0100111001001100
PostPosted: Mon, 26th Mar 2012 08:35    Post subject:
How you achieve stuff depends a lot on the rest of the page. Post the entire page next time Smile
Back to top
Steve-O 2004




Posts: 2851

PostPosted: Wed, 28th Mar 2012 22:48    Post subject:
thanks, I will make a seperate css page I think for the box's


George W Bush -

'...more and more of our imports are coming from overseas.'
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group