IE7: element does not float

I am trying to swim to the right within the h2 element. In IE8 and Firefox, this works great; in IE7 it does not float.

HTML:

<h2>
    <span id="spanA"> /*Should be floated to the right*/
    <span id="spanB">
    <span id="spanC">
</h2>

CSS:

#spanA{
    float: right;
}

Any ideas on what might be wrong?

+3
source share
4 answers

The span tag is an inline element, not a block level element. Thus, it does not float when rendering in accordance with the specification. Have you tried adding display: block; in css for #spanA?

+4
source
<h2>
    <span id="spanA"> /*Should be floated to the right*/
    <span id="spanB">
    <span id="spanC">
</h2>

add this css:

h2 #spanA
{
float:right;
clear:right;    
}
+2
source

, this Ie7 ?

+1

position:absilute right:0;

, , .

0

Source: https://habr.com/ru/post/1754635/


All Articles