tags:

views:

252

answers:

5

For some kind of menu I would like a box of 300 pixels width, with the items in it aligned to the right. I came up with the following code which works just fine in IE and Chrome, but not in FF :

<div style="width:300px;" align="left">
    <div align="right">
        <img  src="images/item1.png">     <br/>
        <img  src="images/item2.png">     <br/>
        <img  src="images/item3.png">     <br/>
        <img  src="images/item4.png">     <br/>
    </div>
</div>

UPDATE : In FF, the images are on the right side of the screen, in stead of aligned right at 300px from the left.

UPDATE 2 : The solution appeared to be text-align...

+1  A: 

Try that:

   <div style="width: 300px;">
     <div style="float: right;">
       <img src='images/item1.png' />
     </div>
    </div>

Oh and also, don't use HTML align parameters, use style.

usoban
it's not working I'm afraid
Peter
can you post image what it looks like?
usoban
Not working for me too.
Muhammad Kashif Nadeem
A: 

Try using this instead:

<div style="width=300px;">
<div style="float: right">
    <img  src="images/item1.png">     <br/>
    <img  src="images/item2.png">     <br/>
    <img  src="images/item3.png">     <br/>
    <img  src="images/item4.png">     <br/>
</div>
</div>
still not working in ff
Peter
+3  A: 

OK, after a lot of trying out things, I found it myself : text-align does the trick (although it's aligning images here)

  <div style="width:300px; text-align:right">
    <img  src="images/item1.png">     <br/>
    <img  src="images/item2.png">     <br/>
    <img  src="images/item3.png">     <br/>
    <img  src="images/item4.png">     <br/>
  </div>
Peter
A: 

try this width : not width =

<div style="width:300px;">
    <div style="float: right">
        <img src="images/item1.png">
        <br />
        <img src="images/item2.png">
        <br />
        <img src="images/item3.png">
        <br />
        <img src="images/item4.png">
        <br />
    </div>
</div>
chugh97
Yes, = was creating problem.
Muhammad Kashif Nadeem
No, not the problem, now it's aligning left in ff
Peter
A: 
<div style="width:300px;">
<div style="float:right">
    <img  src="images/item1.png" alt="img"/>     <br/>
    <img  src="images/item1.png" alt="img"/>     <br/>
    <img  src="images/item1.png" alt="img"/>     <br/>
    <img  src="images/item1.png" alt="img"/>     <br/>
</div>
</div>
Muhammad Kashif Nadeem
I'll try it again
Peter
No, not working, is aligning left now in ff
Peter