1 of 2
1
Floating 3 elements in a fluid width layout
Posted: 16 February 2010 07:26 PM   [ Ignore ]
Newbie
Rank
Total Posts:  1
Joined  2010-02-16

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

Profile
 
 
Posted: 21 July 2010 01:39 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  4
Joined  2010-07-21

We have two declarations: color: Blue and font-size: 3em;. Lastly each declaration consists of two parts: the property color and the value Blue. Phew! Well done for making it this far. The terms above are good to know since it gives you a way to talk about your CSS.SEO Company

Profile
 
 
Posted: 03 October 2010 12:53 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  14
Joined  2010-09-16

So, what’s wrong with your css, from what i see it works right how you want it to work

_________________________

jocuri masini - jocuri barbie

Profile
 
 
Posted: 12 October 2010 01:48 PM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2010-10-06

1.Write a paragraph of text and add an image at the beginning of the paragraph (before the text, but after the tag):

<p>
<
img src="blwebcam-sample.jpg" alt="Suni" />
Duis aute irure dolor sed do eiusmod tempor incididunt in reprehenderit in voluptateCupidatat non proidentut labore et dolore magna aliquaSunt in culpa quis nostrud exercitation excepteur sint occaecatMollit anim id est laborum.
</
p>

Profile
 
 
Posted: 16 November 2010 09:58 AM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  4
Joined  2010-10-26

If you want to float the logo and doesn’t want to use table then you should ajax and make as a layers.

Profile
 
 
Posted: 12 December 2010 02:53 PM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  5
Joined  2010-12-12
Bahnyen - 16 November 2010 09:58 AM

If you want to float the logo and doesn’t want to use table then you should ajax and make as a layers.

Yeah, that’s the right way to do it.

Profile
 
 
Posted: 23 December 2010 01:57 PM   [ Ignore ]   [ # 6 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2010-12-14
ciddiadam - 12 October 2010 01:48 PM
1.Write a paragraph of text and add an image at the beginning of the paragraph (before the text, but after the tag):

<p>
<
img src="blwebcam-sample.jpg" alt="Suni" />
Duis aute irure dolor sed do eiusmod tempor incididunt in reprehenderit in voluptateCupidatat non proidentut labore et dolore magna aliquaSunt in culpa quis nostrud exercitation excepteur sint occaecatMollit anim id est laborum.
</
p>

2.Add a style attribute to the image, and apply the float property:

<img src="blwebcam-sample.jpg" alt="Suni" style="float:left;" />

3.Your text will be rammed right up against the image, so add some margins to the image to make it easier to read:

<img src="blwebcam-sample.jpg" alt="Suni" style="float:left;margin:0 5px 0 0;" />

Care to explain on this a bit more?

Profile
 
 
Posted: 04 February 2011 07:29 AM   [ Ignore ]   [ # 7 ]
Newbie
Rank
Total Posts:  3
Joined  2011-02-04

If you want to float the logo and doesn’t want to use table then you should ajax and make as a layers. I’ve just visited this forum. Happy to get acquainted with you. Thanks.

#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*/

______________________________________
Motor Generators

Profile
 
 
Posted: 04 February 2011 07:38 AM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  15
Joined  2011-01-17

If you’re not planning to support IE Mac, there are many rules and filters you may want to remove.

Profile
 
 
Posted: 19 February 2011 09:15 AM   [ Ignore ]   [ # 9 ]
Jr. Member
RankRank
Total Posts:  44
Joined  2010-10-13

Because border and width adds up, this styling is making columns drop in IE 6 and 7. We could cheat with the value

Profile
 
 
Posted: 20 February 2011 12:21 PM   [ Ignore ]   [ # 10 ]
Newbie
Rank
Total Posts:  1
Joined  2011-02-20
Bahnyen - 16 November 2010 09:58 AM

If you want to float the logo and doesn’t want to use table then you should ajax and make as a layers.

Would like to try this.  Do you have any samples I could have a look at, though?

Thanks,
Panlegis

Profile
 
 
Posted: 20 February 2011 02:14 PM   [ Ignore ]   [ # 11 ]
Newbie
Rank
Total Posts:  23
Joined  2011-01-06

You don’t know the exact width of any column. You want a couple to shrink to whatever is in there, that is different. Now, a floated element will shrink to fit content if you do not specify a width, a useful feature. So let’s stick a couple of floated elements in the container above:

<div style="width: 800px;">
<
p style="float: left">Some content</p>
<
p style="float: left">Some more content</p>
</
div>

Profile
 
 
Posted: 25 February 2011 05:08 PM   [ Ignore ]   [ # 12 ]
Newbie
Rank
Total Posts:  2
Joined  2011-01-25
photon43 - 16 February 2010 07:26 PM

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

How to use this code ?

Profile
 
 
Posted: 28 February 2011 05:41 PM   [ Ignore ]   [ # 13 ]
Newbie
Rank
Total Posts:  12
Joined  2011-01-17

You can use that technique to turn the previous fixed-width, three-column layout into a fluid, three-column layout.

Profile
 
 
Posted: 15 March 2011 05:25 PM   [ Ignore ]   [ # 14 ]
Sr. Member
RankRankRankRank
Total Posts:  133
Joined  2010-04-23

I believe you have to use fixed width. Try 3 columns as suggested with the middle being a variable width.
_____________________________
Sudoku - Flash Game - Flash Game
Flash Game - xnxx - Flash Game

Profile
 
 
Posted: 18 November 2011 06:01 AM   [ Ignore ]   [ # 15 ]
Jr. Member
RankRank
Total Posts:  44
Joined  2010-10-13
miguel - 15 March 2011 05:25 PM

I believe you have to use fixed width. Try 3 columns as suggested with the middle being a variable width.

But what if we can take this even further and attempt a three-column layout with a fluid content area? Not only can we do this, we can do it surprisingly easily! We’ll need to make a few final tweaks to our XHTML by adding a few more divs — and then we’ll be ready to write some more CSS saç ekimi.

Profile
 
 
   
1 of 2
1