Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Float <span> on right and the rest(text) on left, within <div> in ie 7

I have some text and <span> tag, which are inside a <div>.

<span> is float: right; I need the text to be on the left side and <span> on right side.

In every browser it displays perfectly except ie7. How can I fix this bug?

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <title> Testing page</title>
    </head>
    <body>
        <div style="border:2px solid #000; display:inline;"> 
            welcome<span style="float:right"> demo</span>
        </div>
    </body>
</html>
like image 886
RAN Avatar asked Jul 04 '13 12:07

RAN


People also ask

How do you float a div to the right?

Use CSS property to set the height and width of div and use display property to place div in side-by-side format. float:left; This property is used for those elements(div) that will float on left side. float:right; This property is used for those elements(div) that will float on right side.

What happens if float left is applied to the text in navigation bar?

HTML float left is used to align content at the left alignment of the webpage or HTML document. Whenever Float left is used within code, it is responsible for putting contents on the left side of the container.

Can we keep span inside span?

Span is an inline element, therefore having span inside span is valid.


1 Answers

move span before text, this should help.

like image 63
simoncereska Avatar answered Sep 26 '22 06:09

simoncereska