Hi John - I added another row with image-caption on left and text-only on right so you can see how well your solution works for me, at:
at http://www.greensmoothie.com/1gs/
Sadly, since both children are floated, I can’t vertically align the one against the other. I have to adjust with top margin.
A few last questions 
(1) >set all image widths to 99.98%
I don’t understand? Each image has its set width in ratio to its height. I cut it to the size I want (in relation to surrounding text) in a photo editor. The same image can be different sizes on different pages.
(2) You use width 99% for a reason don’t you, on the container? Rather than my 100%. I forget, what’s that reason? Something to do with an IE6/7 bug…
(3) I just checked in 800x600 and Paul’s right, in this case the images are wider than the div, but they don’t break at all, by that I mean the second div doesn’t fall down to next row. That’s all I really care about.
I guess I don’t need to worry that the divs overlap? The only fallout I can see is that in resolution above 800x600, the caption on the left image is wider than the image, and at 800x600 it’s narrower, which I’m ok with.
(4) The “text-align:center” you have on the containing div, is there a reason for that? Now that I have it set at full-width and each child as a percentage of full, I don’t need to keep text-align:center do I? Because it doesn’t do anything?
(5) What does the “none” mean in your ‘background:#fff none’?
thanks! - Val
I resonate with John’s solution because it does what I’ve been doing for 12 years in tables - so it’s very quick for me. I have all the ol’ html of my <table>'s site right there in text editor, I see what percent widths + what alignments I used, and just stick the same css inside the new divs. Nothing for me to think about! I can morph into a zombie…
It reflects my old table structure – except now <table> and <tr> are one <container div> and <td>s are the <child divs> - with the ability to do alignments inside td/div the way I’m used to in tables - a unique align for each of image + caption.
I like that the container + children don’t need special labels (like imgwrap which I’ll forget). All they need is at least one of 14 css rules, namely:
-
8 for width - .w30, 40, 50, 60, 70, 80, 90, 100(99.98?)
-
2 for center-position + text-align - .cnt, hcnt, and perhaps I can get vcnt {vertical-align:middle} and Paul’s vbtm {vertical-align:bottom} to work some day. I’m a bit frustrated I don’t have control over the vertical positions as I did in <td>
-
4 for side-position + text-align - lft, flft, rgt, frgt (f=float).
When I need margin or padding, I add it to the css on as-needed basis, with m for margin + p for padding. And top, rgt, btm, lft. Most are reusable often, e.g. 10 or 20 px.
so mtop20 = margin-top:20px, and p20 = padding:20px. I hope it’s ok that I have about 5 classes on each, that this won’t slow the browser down.
I like to use em for fonts, and px for margin/padding, and limitless for line-height, so when it’s zoomed in or out, it stays looking the way I want.
Paul - I did study your page carefully but I’m not sure if it’ll give me the flexibility I need so I decided to try John’s first, and it works pretty perfectly except for the image-wider-than-div you predicted
- and seemingly no control over horizontal position.
What happened historically is that the first time I came to convert this page into css, I was scared of floats so I’d made a blanket decision never to use them inside my writing box! So I used a table to align a text block vertically against a box with image+caption (today’s example at http://www.greensmoothie.com/1gs/ - but now redone in divs)
Then along the way you gave me clearfix.
Then the other day Ralph mentioned in the thread where he showed me how to do the h2 sub-headers (with background color + leaf-on-left) at:
http://www.sitepoint.com/forums/showthread.php?p=4514765#post4514765
Ralph: “A floated container encloses floated content by default. So floating a container is a valid way to clear floated contents. The reason why it works to float the container here is that the block-level content above and below it (that is, the paragraphs) is width 100%.”
And I misread that as: “A container encloses floated content by default”! And suddenly it clicked for me that all I have to do is stick the floats in a container box labeled clearfix and they’ll never float out and nothing will get in. Since I mis-read what he said, I don’t know now if this is true!
But anyway this misreading of Ralph totally lifted my fear of floats. So it was easy to take the next step of abandoning tables altogether, and switching to floated divs.
thank you! - Val