galer88
galer88

Reputation: 240

Wrap text around span - chrome issue

Open this fiddle in Chrome and Firefox (or IE9, Opera) and see differences.

or see Image:

enter image description here

Can chrome behave like firefox?

Upvotes: 0

Views: 1894

Answers (2)

Code Bunny
Code Bunny

Reputation: 447

I believe no, it can not. Your best bet is to write this in a way that will look the way you want on Chrome and use that version when you detect whether the user is using Chrome or an other browser. See this for more details.

OR

You can use code that will look the same or similar in all current browsers. For your example you need to add:

<span style="float:left">Test </span>

to your text.

Another solution is this:

<html>
<head>
    <style type="text/css">
        #test{
            position: relative;
            left: 120px;
        }
    </style>

</head>
<body style="margin:0px; padding: 0px;">

<span style="width: 100px; background:red; float: left; clear: left; height: 4px;" ></span> 
<span style="width: 220px; background:red; float: left; clear: left; height: 4px;" ></span> 

<div id = "test">
<span>Test </span>
</div>

</body>
</html>​​​

Upvotes: 1

Sanket R. Patil
Sanket R. Patil

Reputation: 311

Just give the style 'float:left' to the div

<html>
<head>

</head>
<body style="margin:0px; padding: 0px;">

<span style="width: 100px; background:red; float: left; clear: left; height: 4px;" ></span>
<span style="width: 220px; background:red; float: left; clear: left; height: 4px;" ></span>

<div style="float:left">
<span>Test </span>
</div>

</body>
</html>

Upvotes: 1

Related Questions