Could someone help me achieve this in CSS?

Basically I want to display two span next to each other. The condition is that first span has max-width 200px so if it exceeds 200px all the overflowed characters are hidden as overflow:hidden is applied to this span. Another condition is that the second span will display all the time next to the first span.

The problem is that since IE does not support (IE7, IE8) max-width feature properly I cannot use this property. Is there any other way to achieve this?

So I have:

<div>
<span>one</span> <--- max width is 200 px
<span>two</span> <--- will alwats display next to span one
</div>

I want to display span 2 always right next to span 1. Adding width to span 1 will leave a huge space between span 1 and span 2 so I cannot do this. I need to expand span 1 dynamically until overflowed. And this need to be cross browser compatible ;(

Thanks.

Answers


Please see if this is what you are after. It works alright in IE8, have tested it.

HTML:

<div id="content">
    <span>oneedaskdaslkdjsaldjaslkdjaslkdjldasdasdasdasdalkdnaskdnasjkdnaskjdnaskjndaskjndajksdnasjkdnkjsandkjsandkjasndkjasndjksandkjsandjkndjksandjkasndjkasndkjasndkjsnajsalkdjasd</span>
  <span>two</span>
</div>

CSS:

div span{display:block;max-width:200px;overflow:hidden;float:left;margin:5px;}

Need Your Help

Measuring TCP delay from Linux kernel

tcp linux-kernel hook delay systemtap

TCP does not prioritize traffic like IP. When there are a lot of TCP background connections opened that are uploading data (like when BitTorrent is seeding in background) delay may occur for a part...

Print multiple tif images on web server

jquery printing tiff

I have a list of tif images file on the web server, I have a button "Print All" in a aspx page that print all tif images hosted on web server.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.