Saturday, April 24, 2010

Firefox and IE. CSS float:right renders differently. how do i fix this?

i have a DIV inside a Table. I set this DIV to float right.



In firefox (which renders the way i like), the content in DIV will display on the right side, and whatever content is in Table, i would display on the left but they BOTH start on the SAME line. In other words, the both content in DIV and Table is next to each other.



However, in IE 7, the Div renders first on the Right, THEN content in Table renders after. ie, as if there's a break %26lt;br%26gt; between the Div and Table content.



I want to code it so that IE displays it like Firefox. is there an attribute i'm missing? and tricks? please help me!



Firefox and IE. CSS float:right renders differently. how do i fix this?web browser





I wrote this code and it seems to work correctly in both Firefox and Internet Explorer:



%26lt;table border="1"%26gt;



%26lt;tr%26gt;



%26lt;td width="800"%26gt;



%26lt;div style="float:right; width: 50px"%26gt;



This is the right side stuff.



%26lt;/div%26gt;



This is the left side stuff.



%26lt;/td%26gt;



%26lt;/tr%26gt;



%26lt;/table%26gt;



Make sure the div that floats right comes before the rest of the test.

No comments:

Post a Comment

 
web hosting servers