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>

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;" />

------------------
burun estetiği | meme küçültme | lazer epilasyon

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.
If you’re not planning to support IE Win lt 5.5, you may ignore the Conditional Comment used to set a smaller width for the first column.
If CSS validation is important to you, regroup all IE rules and put them inside a Conditional Comment.
If you are looking for a 3 column layout with fluid center, stay away from this solution because (as far as I know domain) it can’t be done in IE lt 7.
If you are use to working in Dreamweaver’s design view and these layouts do not make any sense, then look in the help files for “design-time styles sheet” and use that:

#s1,#s2,#s3 {float:left;overflow:hidden;border:0;}
#ft {clear:left;}


Make sure to not publish these rules. Their only purpose is to help Dreamweaver render columns next to each other rather than under each other while keeping the footer at the bottom. Obviously, this won’t give you a “WYSIWYG” picture, but it should help you work in Dreamweaver design view with no problem (i.e. you’ll lose the borders burun estetiği estetik şiir).

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 of the main container to avoid this, but there is another problem anyway: IE makes the columns only as high as their content so borders would not be painted from top to bottom burun estetiği. To address this issue, we style elements that we know have the same height as the tallest column vajina estetiği. These are the second LI and its nested OL, two semantic “wrappers”. As a side note, we could add background colors as well. Note that background and border for IE in the “fluid center” layout on the demo page are created using a totally different method, this one based on structural hacks meme estetiği. The width of the LI is made equal to the width of the two first “columns” while the width of the OL is made equal to the width of the first “column” göğüs büyütme. Then we position the two last “columns” outside of their containers using negatrive values saç ekimi.

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>

However, even at this point there is a problem that would not occur in a table. If the content is large in one or other of the floats, the columns will disappear because room will run out in the 800px container and one of the floats will drop burun estetiği.

No problem if you are not expecting much content! But a related sort of problem will rear its head when we make provision for the fit-to-expand third bit, if it is very long, it will wrap and destroy the column look vajina daraltma. And we cannot give this third bit a left margin in advance because we do not know what space the alan adı sorgulama, web tasarım, masaj salonu, plaka sprgulama, altın fiyatları, telefon sorgulama first two shrink-to-fits will take up

http://www.nevarsa.com

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. Start by setting the width of the wrapper as a percentage of the overall width of the window. In this example I have chosen 85 percent as it produces good results on a range of screen sizes göğüs estetiği. Next, set the width of the navigation and content areas as a percentage of the wrapper width. After a bit of trial and error, setting the navigation area to be 23 percent and the content area to 75 percent produced nice results göğüs küçültme. This leaves a 2-percent virtual gutter between the navigation and the wrapper to deal with any rounding errors and width irregularities that may occur:

#wrapper {   
2   <strong>width85%;</strong>  
3 }   
4   
#mainNav {   
6   <strong>width23%;</strong>  
7   floatleft;   
8 }   
9   
10 
#content {   
11   <strong>width75%;</strong>  
12   floatright;   
13 }

You then need to set the widths of the columns in the content area. This gets a bit trickier as the widths of the content divs are based on the width of the content element and not the overall wrapper göğüs dikleştirme. If you want the secondaryContent to be the same width as the main navigation, you need to work out what 23 percent of the wrapper is in terms of the width of the content area jinekomasti.

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