472,374 Members | 1,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

variable-width spacer between fixed size pictures

Hi everybody,

I'm scratching my head with a CSS problem.

I want to have the following (the two pics have these size for
a good reason, the whole point of the page is basically to show
these pices at these fixed sizes) :

spacer - fixed size picture - spacer - fixed size picture - spacer

Height alignment doesn't matter, all I want is the "horizontal spacer"
to have a variable width.

And I'd like each of the three "spacer" to use one third of the
"remaining width". For example, if the first picture as a width of
350 pixel, the second a width of 250 and the viewable area a
width of 1002 pixels, I'd like to have each spacer taking :

(viewable area width - (350 + 250)) / 3

402 / 3 = 134 pixels

I can do it using a really ugly JavaScript hack (hence not only
ugly but also working only when the browser has JavaScript),
but I want to do it using CSS.

If I'm working only in %, I can do it easily, but here I'm forced
to deal with fixed-size picture and I'm lost.

I gave an example with 3 spacers / 2 fixed-size picture, but it
can be 4 spacers / 3 fixed-size pictures, etc.

Any hint is greatly appreciated,

Driss

Dec 7 '06 #1
2 3947
On 2006-12-07, ne******@yahoo.fr <ne******@yahoo.frwrote:
Hi everybody,

I'm scratching my head with a CSS problem.

I want to have the following (the two pics have these size for
a good reason, the whole point of the page is basically to show
these pices at these fixed sizes) :

spacer - fixed size picture - spacer - fixed size picture - spacer

Height alignment doesn't matter, all I want is the "horizontal spacer"
to have a variable width.

And I'd like each of the three "spacer" to use one third of the
"remaining width". For example, if the first picture as a width of
350 pixel, the second a width of 250 and the viewable area a
width of 1002 pixels, I'd like to have each spacer taking :

(viewable area width - (350 + 250)) / 3

402 / 3 = 134 pixels

I can do it using a really ugly JavaScript hack (hence not only
ugly but also working only when the browser has JavaScript),
but I want to do it using CSS.
This is a tricky one.

The only thing I can think of is to use a table. Give the whole
table a width (1002 pixels say), put each image in a cell on its own,
and between the image cells, put empty cells for the spacers. Set the
widths of the spacer cells to 1002.

Most UAs will make the spacers as wide as possible to get them as close
as they can to the 1002 you've asked for, but will give them all equal
width, and hence will divide up whatever width is left of the total
originally available (1002 pixels) after setting each of the cells with
an image in it to its minimum content width (which should be the width
of the image) equally between the spacers.

This is relying on behaviour that isn't specified anywhere official that
I can find though, although it works in Firefox, Opera and Konqueror.
Dec 7 '06 #2
Hi,
This is a tricky one.
ah damn :(

I hoped I was missing something obvious...

Thanks a lot for your answer

Dec 7 '06 #3

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

Similar topics

1
by: Scott | last post by:
I have an XML Document in a format like: <Variable name="Bob">ABCDEFG</Variable> <Variable name="Steve">QWERTYUI</Variable> <Variable name="John">POIUYTR</Variable> <Variable...
4
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
10
by: Blaxer | last post by:
There is probably a really easy way to do this, so please forgive me but I would like to set the value of a variable from a variable, an example would be... function Calculate_Something(ByVal...
23
by: Russ Chinoy | last post by:
Hi, This may be a totally newbie question, but I'm stumped. If I have a function such as: function DoSomething(strVarName) { ..... }
3
by: rls03 | last post by:
I have the following which creates a variable containing a relative path where <xsl:value-of select="."/returns a portion of the filename: <xsl:variable...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
2
by: Florian Loitsch | last post by:
hi, What should be the output of the following code-snippet? === var x = "global"; function f() { var x = 0; eval("function x() { return false; }"); delete x; alert(x); }
37
by: minkoo.seo | last post by:
Hi. I've got a question on the differences and how to define static and class variables. AFAIK, class methods are the ones which receives the class itself as an argument, while static methods...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.