with tables I can easily have a row with 2 columns, column 1 is variable width and column 2 fixed width in pixels and column 1 resizes to fill the available space. I'm transitioning to css and wondering how to do this with css..and make sure that both divs/columns stay on the same line and don't wrap.
Floats with explicit widths are pretty much the standard way to achieve this nowadays ( due to how limited layout is in CSS1/CSS2 ) , you can also use inline-block but it would just end up being more work. Don't forget to contain the floats on the parent with overflow:hidden and a property that triggers hasLayout like width.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
html, body, div { margin: 0; padding: 0; border: 0 none; }
#left { margin-right: 300px; background: yellow; }
#right { width: 300px; float: right; background: #ccc; }
</style>
</head>
<body>
<div id="wrapper">
<div id="right">Fixed</div>
<div id="left">Variable</div>
</div>
</body>
</html>
This has a right column of 300 pixels and a variable left column. The DOCTYPE is just there to make IE misbehave less. Also use of a reset CSS is recommended.
I'm assuming that what you need here is a 2-columns page layout. In theory, you could use display:table but if you need to support any version of IE, thats not really an option.
This is one of the hardest things some of us encountered when switching from tables to CSS, but fortunately for you, we've been doing this for more than 5 years and I think you can fine a solution for every problem. Maybe you want to check this classic article: Faux Columns
Please, don't feel discouraged, CSS is only hard the first months, and after that you'll be able to layout anything in a very clean, simple, semantic and standard way.