473,766 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3683
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/thumbswithcapti onscentered.htm l>
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
2630
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, each one has a comment line under the picture. And I wish when the screen size is big, this thumbnails arrange 3 rows, 4 columns; if the browser window is smaller, arranges 4 rows, 3 columns; if it's even smaller, 6 rows with 2 columns. If there...
14
5615
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 things). I note the document specifies that block level content can be included within a <map>. Testing this in order to discover why one might wish to do this, I find the block level content is rendered in page flow order anyway, and not...
15
2347
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 for this application. Any fixed choice of column numbers is always the wrong choice! I looked up about CSS block flow , found "display:inline-block;" and thought problem solved - till I tested in IE & FF. Nightmare!!! After *much* fiddling I...
12
3088
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). <!ENTITY % block "P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT | BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS"> <!ENTITY % flow "%block; | %inline;">
7
2701
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 the goals -- the make statement is mostly syntactic sugar for:: class <name> <tuple>: __metaclass__ = <callable>
3
3233
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 "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title>Sparklines</title> <style type="text/css">
6
2022
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 block boxes The principal block box establishes the containing block for descendant boxes and generated
0
2637
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 special situations to render inline elements (like A and SPAN) as block elements that flow with inline items and it seems to work, although I know I shouldn't depend on such: <style>
7
3441
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. I read and re-read carefully the CSS 2.1 spec and I just can not see why. Related webpages: http://www.gtalbot.org/BrowserBugsSection/MSIE8Bugs/MarginBottomChildNotRendered.html
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10009
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.