OK so I am trying to do something I know how to do in a fixed width layout (or in a menu that is a specific width) but can’t seem to get working in a fluid width.
This all takes place in the 82px tall header. all of this should happen on the same line and never break to the next:
I want to float a logo left and then float another image all the way to the right BUT have a single line of text (in an <h1> tag) in the middle between them. The logo should always stay left and the other image should always be at right when the browser is resized. The text should always fall in the center when the browser is resized as well. I do not want to use a table. In fact, this all comes from a “redesign” of a site that is using tables to accomplish this very thing. And I could just do that again. But I have been asked to get it done table-less - Plus, I just want to.
The site that has this going on with the table is this: http://www.bmmg.us
SO in my CSS code I have the following:
*{padding:0;margin:0;}
#body-wrap{width:auto; height:auto; margin:0 auto 0 auto;}
#header{width:auto;height:82px;background:url(img/header-bg.jpg) repeat-x top;} /*this is the header container*/
#logo{background:url(img/BMAHeader.jpg) no-repeat top; height:82px; width:384px; float:left; }/*this is the logo container*/
#tag{height:82px; display:inline;float: left;} /*this is where the text is*/
#tag2{float:right; display:inline; background:url(img/headerright.jpg) no-repeat top; width:311px; height:82px;} /*this is the 2nd image's container*/
Markup:
<div id="body-wrap">
<div id="header">
<div id="logo">
</div>
<div id="tag">
<h1>www.bmmg.us</h1>
</div>
<div id="tag2">
</div>
</div>
</div>
I would really like to get the CSS to behave exactly like the table version does (http://www.bmmg.us). The “<h1>www.bmmg.us</h1>” should “float” in the center of these two images AND if the browser resizes to a width smaller than the content allows for, the image and/or text should NOT drop to the next line. Scroll bars should appear instead.
This really does not seem like it should be that hard and it certainly does not seem that a table can do something better than a div can. That’s crazy talk, right!?
Anyway, please help out. Thanks y’all!
Dan