473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

css: fill regardless

Good Morning

Firefox/2.0.0.14
IE/7.0.5730.11
Opera/9.27

I thought I'd test out my new free server with a couple of URLs (see below)

I want an area to 'fill right' regardless of it's contents. If it
contains nothing I don't want anything to appear. If something does
appear then it must have a 10px left margin and a 10px top margin. I
understand the problems with using pixel values but this is just an
illustration.

This question is quite explicit and concerns only <div id='contentbit'>
as far as I can tell. The example is incomplete in that eventually
contentbit will contain three columns (either <tdor <divdepending on
what I can get working).
If I 'float:left; contentbit then I get the result at

http://duncanidaho.0fees.net/threecolumnfloat.html

This is no good because contentbit does not fill the space available.

If I don't float:left contentbit then I get the result at

http://duncanidaho.0fees.net/threecolumnnofloat.html

This is no good because contentbit overlaps leftbit.
What I'd like is contentbit to float:left and fill it's space (with
appropriate margins) I would have thought this is a common requirement
but I just can't crack it without introducing some sort of explicit
value for the width of contentbit.

Any advice much appreciated

TIA

--
Idaho
Jun 27 '08 #1
3 1854
On 2008-05-10, DuncanIdaho <Du**************@googlemail.comwrote:
Good Morning

Firefox/2.0.0.14
IE/7.0.5730.11
Opera/9.27

I thought I'd test out my new free server with a couple of URLs (see below)

I want an area to 'fill right' regardless of it's contents. If it
contains nothing I don't want anything to appear. If something does
appear then it must have a 10px left margin and a 10px top margin. I
understand the problems with using pixel values but this is just an
illustration.

This question is quite explicit and concerns only <div id='contentbit'>
as far as I can tell. The example is incomplete in that eventually
contentbit will contain three columns (either <tdor <divdepending on
what I can get working).
If I 'float:left; contentbit then I get the result at

http://duncanidaho.0fees.net/threecolumnfloat.html

This is no good because contentbit does not fill the space available.

If I don't float:left contentbit then I get the result at

http://duncanidaho.0fees.net/threecolumnnofloat.html

This is no good because contentbit overlaps leftbit.
What I'd like is contentbit to float:left and fill it's space (with
appropriate margins) I would have thought this is a common requirement
but I just can't crack it without introducing some sort of explicit
value for the width of contentbit.
You're setting an explicit width for leftbit, so just give contentbit a
margin left of 10.5em or so. 10em to get it past leftbit and another
0.5em because you wanted about 10px.

I think that's the easiest thing to do there, but there is a way to get
exactly the behaviour you want which is to make contentbit a
block formatting context but not a float. You can do that by making it
overflow: hidden (this probably doesn't work in IE).

You might ask what has overflow got to do with the width of a box. Long
story, but one of the side-effects of overflow: hidden is that it starts
a new block formatting context, and the basic rule here is that floats
don't cross block formatting context boundaries.

So your float on the left (leftbit) is not allowed inside contentbit if
contentbit is a BFC.

The CSS 2.1 spec allows browsers to do one of two things: make
contentbit narrower (which is what you want) or drop it below the float
(which you don't want, but which none of them do in practice).

If you're putting a table in contentbit anyway, just don't bother with
the div. The table (well the table cells actually) start BFCs so they
will go to the right of the float in the way you want anyway.
Jun 27 '08 #2
DuncanIdaho wrote:
>
If I don't float:left contentbit then I get the result at

http://duncanidaho.0fees.net/threecolumnnofloat.html

This is no good because contentbit overlaps leftbit.

What I'd like is contentbit to float:left and fill it's space (with
appropriate margins)
#contentbit{
border: 1px solid black;
/*margin-left: 10px;*/ /* delete this */
margin-top: 10px;
margin-left: 10em; /* moves the container */
padding-left: 10px; /* moves the content */
}

--
Gus
Jun 27 '08 #3
Ben C wrote:
On 2008-05-10, DuncanIdaho <Du**************@googlemail.comwrote:
>Good Morning

Firefox/2.0.0.14
IE/7.0.5730.11
Opera/9.27

I thought I'd test out my new free server with a couple of URLs (see below)

I want an area to 'fill right' regardless of it's contents.
snip]
>...but there is a way to get
exactly the behaviour you want which is to make contentbit a
block formatting context but not a float. You can do that by making it
overflow: hidden (this probably doesn't work in IE).
Ah, well I'm starting to understand a bit about overflow but this is a
new wrinkle (maybe the main one), anyway It does seem to work in my
selected browsers. It's the solution I was looking for as in the real
world the leftbit will be able to grow and shrink depending on the depth
of nodes in the navigation tree. The only odd thing is that if I set
contentbit.margin-left: 0.5em; the margin doesn't appear in IE but if I
set leftbit.margin right 0.5em all of a sudden I get a marging between
leftbit and contentbit. I'm not trying to understand why this should be
at the moment, anyway, thanks for taking the time to reply.

--
Idaho
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Richard Speiss | last post by:
I am trying to display a random background image for a webpage. I found this code to do it <% 'Defines the number of background images you have Const NUMBER_OF_IMAGES = 2 'Initiates the...
145
by: Mark Johnson | last post by:
Oddly enough, I found it difficult, using Google, to find a list of best-of sites based on the quality of their css packages. So I'd ask. Does anyone know of particularly good sites which are in...
2
by: Mario T. Lanza | last post by:
Greetings, I have been developing websites in CSS for a couple years; I claim to be no expert, but certain things could definitely be easier. Consider the box model and it's different...
7
by: Wilhelm Kutting | last post by:
Hi again i want to replace the following layouttabel with css/xhtml: ---------------------------------- <table width="640" cellspacing="0"> <tr> <td valign="top">My Title</td> <td...
6
by: Jim Lawton | last post by:
I am trying to achieve a simple page layout using only divs and css. I know that people bad mouth IE for non-conformance, but in this case IE's(6.0)behaviour is entirely the way I expect, and Gecko...
2
by: Brian Henry | last post by:
I am trying to create a page with a header, footer, a document body, and a left navigation plain.. I want the page to fill by default to the browsers max size if the content of the documentbody do...
1
by: Andrew Neiderer | last post by:
This is a simple fix, I hope, but I am unsure how to this. I am using an internal stylesheet, and doing animation of color. The first 3 rectangles display properly using hexcodes in the code...
6
by: Hacking Bear | last post by:
Hi, I still don't quite fully understand how to handle mixing border/margin pixel width with percentage width. In the example below, I want to place side-by-side two DIV boxes inside a box....
53
by: brave1979 | last post by:
Please check out my javascript library that allows you to create any layout for your web page, nested as deep as you like, adjusting to width and height of a browser window. You just describe it in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.