0

I only need one column on my index page and I want it to be on the right side of the screen. I am using a background image that has what I want on the left. bg-image is in the body

I am trying this approach but it is not getting all the way to the right. Am I going about this wrong and more generally how do you position one column to the right of the screen?

<div style=" float:right" >
   <div class="one"></div>
   <div class="two"></div>
   <div class="three"></div>
   <div class="four"></div>

</div>

css for the four inner divs

body{
background-image: url(images/splashpage.jpg);
background-position:top;
font-family: Arial, Helvetica, sans-serif;


  }
.one{
 <!-- width:40%; -->
 background-color:lightblue;
 font-family: Arial, Helvetica, sans-serif;
 position:relative;

 <!-- left:150px; -->

}
.two{
 width:580px;
 background-color:lightgreen;
 position:relative;
 right:100px;
 top:50px;
}
.three{
 width:600px;
 background-color:blue;
 position:relative;
 right:100px;

}
.four{
 width:580px;
 position:relative;
 left:20px;
 margin: 0 auto;
 top:50px;

}
.footer{
 width:580px;
 text-align:center;
 position:relative;
 top:50px;
rogerthat
  • 1,805
  • 4
  • 20
  • 34

1 Answers1

0

this was working fine for the containing div to float right, but all this was doing was putting the inner divs side by side and I need them to stack.

<div style=" float:right" class="container" >
  <div class="one" style="float:right"></div>
  <div class="two" style="float:right"></div>
  <div class="three" style="float:right"></div>
  <div class="four" style="float:right"></div>
</div>

so I put a clear div in between each and now the container div floats right as well as the inner divs while stacking. It seems simple now but maybe if someone else has this problem this will help.

<div style=" float:right" class="container" >
  <div class="one" style="float:right"></div>
     <div style="clear:both"></div>
  <div class="two" style="float:right"></div>
     <div style="clear:both"></div>
  <div class="three" style="float:right"></div>
     <div style="clear:both"></div>
  <div class="four" style="float:right"></div>
</div>

not sure if its best practice or if there's a more efficient way but it works.

rogerthat
  • 1,805
  • 4
  • 20
  • 34