473,386 Members | 1,708 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.

How to make block elements flow?

I'm working on this page
(http://pages.cpsc.ucalgary.ca/~degraaf/test/test.html). In the central
(green-bordered) area, I want a bunch of (red-bordered) blocks each
containing a thumbnail image and some text. The blocks must be of
fixed, equal size. (Obviously, I'll have to limit the amount of text to
fit this size.) The text must be positioned below the image. Within
the central area, I want these blocks to flow like text; ie, for each
one to be positioned to the right of the previous one until no more
horizontal space is available, and then resuming below at the far left.
I want this layout to adapt to the size of the browser window, so using
absolute positioning is out.

However, if I define these blocks as block elements, I can't get them to
flow. If I define them as inline elements, the captions flow with the
images rather than staying below.

How can I define these blocks to get the layout that I described?

Thanks,
Rennie deGraaf
Jul 24 '05 #1
3 3663
Els
Rennie deGraaf wrote:
I'm working on this page
(http://pages.cpsc.ucalgary.ca/~degraaf/test/test.html). In the central
(green-bordered) area, I want a bunch of (red-bordered) blocks each
containing a thumbnail image and some text. The blocks must be of
fixed, equal size. (Obviously, I'll have to limit the amount of text to
fit this size.) The text must be positioned below the image. Within
the central area, I want these blocks to flow like text; ie, for each
one to be positioned to the right of the previous one until no more
horizontal space is available, and then resuming below at the far left.
I want this layout to adapt to the size of the browser window, so using
absolute positioning is out.

However, if I define these blocks as block elements, I can't get them to
flow. If I define them as inline elements, the captions flow with the
images rather than staying below.

How can I define these blocks to get the layout that I described?


Set "float:left;" for each block.

An example (using 2 celled tables, but it should work for divs as
well):
http://locusmeus.com/test/thumbswithcaptions.html

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Shlomo Artzi - Under Medierranean Skies
Jul 24 '05 #2
Els wrote:
Rennie deGraaf wrote:

I'm working on this page
(http://pages.cpsc.ucalgary.ca/~degraaf/test/test.html). In the central
(green-bordered) area, I want a bunch of (red-bordered) blocks each
containing a thumbnail image and some text. The blocks must be of
fixed, equal size. (Obviously, I'll have to limit the amount of text to
fit this size.) The text must be positioned below the image. Within
the central area, I want these blocks to flow like text; ie, for each
one to be positioned to the right of the previous one until no more
horizontal space is available, and then resuming below at the far left.
I want this layout to adapt to the size of the browser window, so using
absolute positioning is out.

However, if I define these blocks as block elements, I can't get them to
flow. If I define them as inline elements, the captions flow with the
images rather than staying below.

How can I define these blocks to get the layout that I described?

Set "float:left;" for each block.

An example (using 2 celled tables, but it should work for divs as
well):
http://locusmeus.com/test/thumbswithcaptions.html


Thanks, that worked. Now, for my next question.

I have a bunch of image thumbnail DIVs, as described above, flowing like
text inside a fixed-size container DIV
(http://pages.cpsc.ucalgary.ca/~degra...t/index2.html). I would like
each line of these thumbnail DIVs to be centered within the container,
like a center-aligned paragraph of text.

I tried containing the thumbnail DIVs within another DIV with
margin-right=margin-left=auto and text-align=center, but it didn't work
unless I hard-coded the width. Since the width depends on the width of
the browser window, I can't do this in general. I could calculate the
width of the minimum bounding box at view-time with JavaScript, I
suppose, but I'd rather not if there's any better way.

How can I achieve this effect using HTML/CSS?

Rennie deGraaf
Jul 24 '05 #3
Els
Rennie deGraaf wrote:
Els wrote:
Rennie deGraaf wrote:

I'm working on this page
(http://pages.cpsc.ucalgary.ca/~degraaf/test/test.html). In the central
(green-bordered) area, I want a bunch of (red-bordered) blocks each
containing a thumbnail image and some text. The blocks must be of
fixed, equal size. (Obviously, I'll have to limit the amount of text to
fit this size.) The text must be positioned below the image. Within
the central area, I want these blocks to flow like text; ie, for each
one to be positioned to the right of the previous one until no more
horizontal space is available, and then resuming below at the far left.
I want this layout to adapt to the size of the browser window, so using
absolute positioning is out.

However, if I define these blocks as block elements, I can't get them to
flow. If I define them as inline elements, the captions flow with the
images rather than staying below.

How can I define these blocks to get the layout that I described?

Set "float:left;" for each block.

An example (using 2 celled tables, but it should work for divs as
well):
http://locusmeus.com/test/thumbswithcaptions.html


Thanks, that worked. Now, for my next question.

I have a bunch of image thumbnail DIVs, as described above, flowing like
text inside a fixed-size container DIV
(http://pages.cpsc.ucalgary.ca/~degra...t/index2.html). I would like
each line of these thumbnail DIVs to be centered within the container,
like a center-aligned paragraph of text.

I tried containing the thumbnail DIVs within another DIV with
margin-right=margin-left=auto and text-align=center, but it didn't work
unless I hard-coded the width. Since the width depends on the width of
the browser window, I can't do this in general. I could calculate the
width of the minimum bounding box at view-time with JavaScript, I
suppose, but I'd rather not if there's any better way.

How can I achieve this effect using HTML/CSS?


<http://locusmeus.com/test/thumbswithcaptionscentered.html>
Widths won't be preserved in Gecko browsers as you can see.
(unless the pics are all of equal width)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 24 '05 #4

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

Similar topics

7
by: Zhang Weiwu | last post by:
Hello. This is problem puzzled me a long time. I wish to organize some block elements and let them flow one after each other like text. Think about a album, I wish the album have 12 thumbnails,...
14
by: laurence | last post by:
I am implementing a comprehensive image-map generator utility, so have been studying W3C HTML 4.01 Specification (http://www.w3.org/TR/html4/struct/objects.html#h-13.6) on image maps (among other...
15
by: otto | last post by:
Any suggestions? I want a sequence of composite "blocks" (e.g. image and caption representing a product category) to wrap like text as a browser is made wider/narrower. Tables are not working well...
12
by: Eric Lindsay | last post by:
I'm trying to learn how to read a DTD I wanted to use, http://www.w3.org/TR/html4/strict.dtd to ensure I was treating each element correctly in terms of being block, inline, or flow (either). ...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
3
by: David Golightly | last post by:
I'm taking a stab at making CSS sparklines - see http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR&topic_id=1&topic= <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC...
6
by: dave8421 | last post by:
Hi, I'm a bit confused about the definition about "Prinicpal Block Boxes" in CSS 2.1 draft specification. ( http://www.w3.org/TR/2006/WD-CSS21-20061106 ) <pre> 9.2.1 Block-level elements and...
0
by: Shadow Lynx | last post by:
Could someone sum up the difference(s) between the standard CSS display: inline block and the non-standard Firefox (Mozilla) display: - moz-inline-box? I have used the following in a couple of...
7
by: GTalbot | last post by:
Hello fellow authoring.stylesheets colleagues, Can someone please explain why the bottom margin of the last inflow block-level child in an overflowed parent should not have its margin reachable....
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.