473,405 Members | 2,141 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,405 software developers and data experts.

Evenly spaced images

Here's the problem. I want to display a known number of images, evenly
spaced out across the width of a div. (The images are not all the same
width; the centers should be evenly spaced.) The div changes width with the
browser, so the layout needs to be fluid. If the div narrows too much, the
images should wrap; in this event, the images on each row should be evenly
spaced (the spacing can vary from row to row).

I can't figure out how to do this. With tables, it's easy enough to do
everything for a single row, but not the wrapping. With css, I can get the
wrapping, but can't figure out how to space things evenly. I tried
text-align: justify, which does the job except for the last row of images.
Unfortunately, the default case is a single row. (I know about
text-align-last, but that's css3 and this needs to work in today's
browsers.)

Thanks,

Ted Hopp
Feb 12 '07 #1
5 12407
"Hopp Family" <ad****@erols.comwrote:
>Here's the problem. I want to display a known number of images, evenly
spaced out across the width of a div. (The images are not all the same
width; the centers should be evenly spaced.) The div changes width with the
browser, so the layout needs to be fluid. If the div narrows too much, the
images should wrap; in this event, the images on each row should be evenly
spaced (the spacing can vary from row to row).
Not possible.

Without the wrapping:
http://homepage.ntlworld.ie/spartani...ced_images.htm

--
Spartanicus
Feb 12 '07 #2
Hopp Family wrote:
Here's the problem. I want to display a known number of images, evenly
spaced out across the width of a div. (The images are not all the same
width; the centers should be evenly spaced.) The div changes width with the
browser, so the layout needs to be fluid. If the div narrows too much, the
images should wrap; in this event, the images on each row should be evenly
spaced (the spacing can vary from row to row).
Since spacing between rows isn't a problem for you, try adding a
margin-right or margin left to the image.

img {
margin-right: 20px
}

Feb 12 '07 #3
Hopp Family wrote:
Here's the problem. I want to display a known number of images, evenly
spaced out across the width of a div. (The images are not all the same
width; the centers should be evenly spaced.) The div changes width with the
browser, so the layout needs to be fluid. If the div narrows too much, the
images should wrap; in this event, the images on each row should be evenly
spaced (the spacing can vary from row to row).
Strike my previous response...I missed "evenly."
Feb 12 '07 #4
Hopp Family wrote:
Here's the problem. I want to display a known number of images, evenly
spaced out across the width of a div. (The images are not all the same
width; the centers should be evenly spaced.) The div changes width with the
browser, so the layout needs to be fluid. If the div narrows too much, the
images should wrap; in this event, the images on each row should be evenly
spaced (the spacing can vary from row to row).

An easy solution may be to text-align: center; your container, then
place margins or padding on the images. It may not be exactly what
you're looking for but if you could give a little more info. it would
help a lot.

img {
margin-right: 20px;
}
..container {
text-align: center;
}

<div class="container">
<img style="width: 172px; height: 122px;" alt="butterfly"
src="images/butterfly2.png">
<img style="width: 172px; height: 122px;" alt="butterfly"
src="images/butterfly2.png">
</div>

Feb 12 '07 #5
Unfortunately, this doesn't work when images are different widths. I'm sadly
beginning to believe that Spartanicus's answer ("Not possible.") is it.
*sigh*

Ted Hopp
"zzpat" <zz*******@gmail.comwrote in message
news:eq********@enews4.newsguy.com...
Hopp Family wrote:
>Here's the problem. I want to display a known number of images, evenly
spaced out across the width of a div. (The images are not all the same
width; the centers should be evenly spaced.) The div changes width with
the browser, so the layout needs to be fluid. If the div narrows too
much, the images should wrap; in this event, the images on each row
should be evenly spaced (the spacing can vary from row to row).


An easy solution may be to text-align: center; your container, then place
margins or padding on the images. It may not be exactly what you're
looking for but if you could give a little more info. it would help a lot.

img {
margin-right: 20px;
}
.container {
text-align: center;
}

<div class="container">
<img style="width: 172px; height: 122px;" alt="butterfly"
src="images/butterfly2.png">
<img style="width: 172px; height: 122px;" alt="butterfly"
src="images/butterfly2.png">
</div>

Feb 12 '07 #6

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

Similar topics

0
by: Michal Mikolajczyk | last post by:
For some reason, when I write data to a csv file using the csv module of python 2.3 and then open it in excel, every row is double spaced. I want the csv file to have every row filled with data...
6
by: kjm | last post by:
Hi Everyone, I am trying to port some old MatLab code to python, and am stuck on how to accomplish something. I am trying to write a generalized function that will create a linearly spaced...
3
by: flamesrock | last post by:
Lets say I have a list containing 12, 13, 23 or however many entries. What I want is the greatest number of lists evenly divisible by a certain number, and for those lists to be assigned to...
5
by: alan b | last post by:
I am still struggling with simple html codes putting <p> xxyyzz </p> on each line. Instead the page shows DOUBLE SPACED. I dont want that! how do I set it into Single Spaced page? ...
2
by: webmaker | last post by:
I have a table that is a menu containing 10 items horizontally. I want it to be able to stretch across the screen sizing itself appropriately. I have each item in a separate table cell and I was...
6
by: VB Programmer | last post by:
When edit a page in page-layout, if you hit the <ENTER> button it always seems double spaced. If I want the controls/text to be closer together do I have to make them rows of a table and size them...
15
by: Alan Silver | last post by:
Hello, I have just been trying a CSS-based design that works as I expected in FF and Opera, but has a problem with IE. If you look at my current version at...
0
by: PromisedOyster | last post by:
I have an ASP menu (.NET 2.0) that is populated from the sitemap (see below for definition). However, I notice that the elements in the menu are not spaced evenly across. Is there any way to...
2
by: Terry | last post by:
Hi everyone. I am rather new to the css game and as such would appreciate a little help. I have been given the task to create a page which follows the design shown at the following link: ...
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: 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
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
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...
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,...
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.