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

Min()/max()

Hi!

Why doesn't CSS support primitive functions like min()/max()? Something like

blah
{
width: max(50px,20%); // 20%& but not less than 50px
}

would really often be useful..

Timo
Jul 20 '05 #1
36 3115
Timo Nentwig <tc*@spamgourmet.org> wrote:
Why doesn't CSS support primitive functions like min()/max()? Something like
Because CSS is not a programming language and therefor doesn't contain
any functions at all?
blah
{
width: max(50px,20%); // 20%& but not less than 50px
}
Sounds like,
blah {
max-width: 20%;
min-width: 50px;
}
would really often be useful..


Tell Microsoft, maybe they'll support min-width and max-width at some
point in the future. After all it's only six years since CSS2 was
published.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2
Timo Nentwig <tc*@spamgourmet.org> wrote:
Why doesn't CSS support primitive functions like min()/max()?

blah {
width: max(50px,20%); // 20%& but not less than 50px
}

would really often be useful..


blah {
min-width: 50px;
max-width: 20%;
}

Write to your congressman if this doesn't work in the browser
everybody uses, they all seem to be on Microsoft's payroll.
Jul 20 '05 #3
Steve Pugh <st***@pugh.net> wrote:
Timo Nentwig <tc*@spamgourmet.org> wrote:
Why doesn't CSS support primitive functions like min()/max()?


Because CSS is not a programming language and therefore doesn't contain
any functions at all?


Well, there are some functions actually called functions in property
declarations: url(), counter().
Jul 20 '05 #4
Steve Pugh wrote:
Because CSS is not a programming language and therefor doesn't contain
any functions at all?


text-transform: lowercase;
Jul 20 '05 #5
Steve Pugh wrote:
Sounds like,
blah {
max-width: 20%;
min-width: 50px;
}


No, sounds like min()/max(). The above is quite stupid, do you want to
invent a min-/max- for everything? min-font-size/max-font-size,
min-this/max-that?
Jul 20 '05 #6
Timo Nentwig <tc*@spamgourmet.org> wrote:
Steve Pugh wrote:
Sounds like,
blah {
max-width: 20%;
min-width: 50px;
}
No, sounds like min()/max().


Which don't exist.
The above is quite stupid, do you want to
invent a min-/max- for everything? min-font-size/max-font-size,
min-this/max-that?


I'm not the W3C. max-width and min-width exist in the CSS2 spec. If
you don't like them take it up with the W3C.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #7
Timo Nentwig <tc*@spamgourmet.org> wrote:
Steve Pugh wrote:
Because CSS is not a programming language and therefor doesn't contain
any functions at all?


text-transform: lowercase;


You think that's a function? You'll be telling us next that
font-weight: bold; is a function as well.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #8
Steve Pugh wrote:
Timo Nentwig <tc*@spamgourmet.org> wrote:
Why doesn't CSS support primitive functions like min()/max()?
Something like


Because CSS is not a programming language and therefor doesn't contain
any functions at all?

[snip]

Actually "50%" is, in effect, a sort-of function. It says (sort-of) find the
container width & multiply by 0.5.

I wish it went just one stage further, such as (50% - 100px), which would not
require more "knowledge" than it already had. It would make handling columns
in flexible layouts a bit easier.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #9
In article <c4*************@ID-18956.news.uni-berlin.de>,
Timo Nentwig <tc*@spamgourmet.org> wrote:
Why doesn't CSS support primitive functions like min()/max()? Something like

blah
{
width: max(50px,20%); // 20%& but not less than 50px
}


A similar syntax was discussed back in the 1999-2000 time frame,
actually, having arisen from a disucssion on column layout. As I
recall, it was rejected on the grounds that such values would be
completely unreadable by browsers that didn't support range values (as
they were then called). In other words, what you have above would be
ignored by every browser on the market today. That could be something
of a problem.
We ran into similar problems for a variant syntax I came up with at
that time, which went something like this:

width: 7em+ 10em~ 15em-

....which would have made the element no less than 7em wide and no more
than 15em wide, with a preferred width of 10em. There were a lot of
fuzzy areas that never got resolved (like whether those were even the
right symbols to use, let alone what happened in the more pathological
cases) because the grammatical problems shot the whole idea down before
we got to hashing out the details of how the proposal might work.

--
Eric A. Meyer (er**@meyerweb.com) http://www.meyerweb.com/eric/
Author, "Cascading Style Sheets: The Definitive Guide,"
"Eric Meyer on CSS," "CSS 2.0 Programmer's Reference," and more
http://www.meyerweb.com/eric/books/
Jul 20 '05 #10
Eric A. Meyer wrote:
[snip]
We ran into similar problems for a variant syntax I came up with at
that time, which went something like this:

width: 7em+ 10em~ 15em-

...which would have made the element no less than 7em wide and no more
than 15em wide, with a preferred width of 10em. There were a lot of
fuzzy areas that never got resolved (like whether those were even the
right symbols to use, let alone what happened in the more pathological
cases) because the grammatical problems shot the whole idea down
before we got to hashing out the details of how the proposal might
work.


Were simpler variants ever discussed? The one that keeps appearing on people's
wish-list is to do very simple sums to generate a specific width, rather than
a range of widths. Even as crude as (100% - 300px), which might be the width
left after allowing for a couple of sidebars. (Wouldn't that sum be easy to do
in all cases where 100% itself could be evaluated?)

(It keeps appearing in connection with multi-column layouts. Perhaps it is
argued that using normal flow plus display:table would achieve what is needed,
but I think some people would quite like to be able to float the sidebars yet
have a different linearisation. And achieving a column effect for the variable
column using large left & right margins is not so good once that box has
dropped below the sidebars at narrow viewports).

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #11
"Steve Pugh" <st***@pugh.net> wrote in
comp.infosystems.www.authoring.stylesheets:
Timo Nentwig <tc*@spamgourmet.org> wrote:
Why doesn't CSS support primitive functions like min()/max()? Something like
Because CSS is not a programming language and therefor doesn't contain
any functions at all?


There's no reason a purely declarative language like CSS couldn't
have things that look like functions. I think you dismiss the intent
of the question a little too quickly.

I too have occasionally wanted that ability: "margin-left: 10% or
2em, whichever is more."
blah {
width: max(50px,20%); // 20%& but not less than 50px
}

Sounds like,
blah { max-width: 20%; min-width: 50px; }


Is there a similar way to do what I'm asking? I don't see one, but
maybe I'm missing the obvious.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #12
Stan Brown <th************@fastmail.fm> wrote:
"Steve Pugh" <st***@pugh.net> wrote in
comp.infosystems.www.authoring.stylesheets:
Timo Nentwig <tc*@spamgourmet.org> wrote:
Why doesn't CSS support primitive functions like min()/max()? Something like


Because CSS is not a programming language and therefor doesn't contain
any functions at all?


There's no reason a purely declarative language like CSS couldn't
have things that look like functions. I think you dismiss the intent
of the question a little too quickly.


I may well have been slightly terse. However, in general I feel that
there is always a temptation to overload a language with too many
features and the result is both bloated software and incomprensible
specifications.

I would suggest leaving CSS as a simple stylesheet language and leave
the functional work to something else, such as JavaScript. Microsoft
have already gone down this route with their expression() syntax.
Another route is to modify style properties via the DOM.

As most graphical browsers already support JavaScript this seems to be
a better use of resources than duplicating similar functionality in
CSS.

A well written stylesheet would contain declared values for non-JS
browsers and then over ride them with more complex modified values
dependent on JS calculations.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #13

"Steve Pugh" <st***@pugh.net> wrote in message
news:sb********************************@4ax.com...
Stan Brown <th************@fastmail.fm> wrote:
"Steve Pugh" <st***@pugh.net> wrote in
comp.infosystems.www.authoring.stylesheets:
Timo Nentwig <tc*@spamgourmet.org> wrote:

Why doesn't CSS support primitive functions like min()/max()? Something like
Because CSS is not a programming language and therefor doesn't contain
any functions at all?
There's no reason a purely declarative language like CSS couldn't
have things that look like functions. I think you dismiss the intent
of the question a little too quickly.


I may well have been slightly terse. However, in general I feel that
there is always a temptation to overload a language with too many
features and the result is both bloated software and incomprensible
specifications.


How is that? If a useful feature is omitted from the language or a widely
accepted common library, then, by the premise that the feature would have
been useful, programmers will often write lengthy code to produce the same
effect. And some developers on a project will be unaware of code already
written by team members to produce that effect, and will write their own. In
the worst case, the code won't even be put into its own procedures, but will
be repeated everywhere the effect is needed.

Do you know how many times I've written the equivalent of

dim a
if (x > y) then
a = x
else
a = y
end if
dim b
b = f(a)

when

dim b
b = f(max(x, y))

would have been much easier? Visual Basic, SQL, and some other language lack
this most obvious of functions. (SQL has "max" as an aggregate function
applicable to a column, but not in the form I'm discussing here.)



I would suggest leaving CSS as a simple stylesheet language and leave
the functional work to something else, such as JavaScript. Microsoft
have already gone down this route with their expression() syntax.
Another route is to modify style properties via the DOM.

As most graphical browsers already support JavaScript this seems to be
a better use of resources than duplicating similar functionality in
CSS.

A well written stylesheet would contain declared values for non-JS
browsers and then over ride them with more complex modified values
dependent on JS calculations.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>


Jul 20 '05 #14
In article <KXUcc.299$jI6.6@newsfe1-win>,
"Barry Pearson" <ne**@childsupportanalysis.co.uk> wrote:
Eric A. Meyer wrote:
[snip]
We ran into similar problems for a variant syntax I came up with at
that time, which went something like this:

width: 7em+ 10em~ 15em-

...which would have made the element no less than 7em wide and no more
than 15em wide, with a preferred width of 10em. There were a lot of
fuzzy areas that never got resolved (like whether those were even the
right symbols to use, let alone what happened in the more pathological
cases) because the grammatical problems shot the whole idea down
before we got to hashing out the details of how the proposal might
work.
Were simpler variants ever discussed?


I don't recall anyone proposing simpler variants on that particular
concept (range values / constrained values). There weren't a whole lot
of proposals along those lines anyway. I did some quick digging earlier
and mine was the only one I could find, and that was posted on the WG's
internal list. If there was a similar proposal, public or private, I
was either looking in the wrong places or using the wrong search terms.
The one that keeps appearing on people's
wish-list is to do very simple sums to generate a specific width, rather than
a range of widths. Even as crude as (100% - 300px), which might be the width
left after allowing for a couple of sidebars. (Wouldn't that sum be easy to do
in all cases where 100% itself could be evaluated?)


That would run into the same grammar problems, I should think. Any
browser today should interpret 'width: (100%-300px);' as 'width: ;' as
per the CSS forward-compatible parsing rules, thus effectively nulling
the declaration. Even if such expressions were supported, to use them
in a real-world Web situation, you'd end up with stuff like this:

padding: 0 150px;
width: auto;
width: (100%-300px);

....and then as you started to pile on CSS or other hacks to step around
the browser bugs that already exist, the situation would quickly get--
well, pretty messy.
Personally, I wouldn't mind there being a way to introduce constraint
systems and simple expressions into CSS, but then I also think that
author-defined value aliases are a good idea. So that goes to show what
I know.

--
Eric A. Meyer (er**@meyerweb.com) http://www.meyerweb.com/eric/
Author, "Cascading Style Sheets: The Definitive Guide,"
"Eric Meyer on CSS," "CSS 2.0 Programmer's Reference," and more
http://www.meyerweb.com/eric/books/
Jul 20 '05 #15
Harlan Messinger wrote:
b = f(max(x, y))

would have been much easier? Visual Basic, SQL, and some other language lack
this most obvious of functions. (SQL has "max" as an aggregate function
applicable to a column, but not in the form I'm discussing here.)


But at least CSS does have important functions such as rgb(r,g,b)...
Jul 20 '05 #16
Eric A. Meyer wrote:
In article <KXUcc.299$jI6.6@newsfe1-win>,
"Barry Pearson" <ne**@childsupportanalysis.co.uk> wrote: [snip]
The one that keeps appearing on people's
wish-list is to do very simple sums to generate a specific width,
rather than a range of widths. Even as crude as (100% - 300px),
which might be the width left after allowing for a couple of
sidebars. (Wouldn't that sum be easy to do in all cases where 100%
itself could be evaluated?)


That would run into the same grammar problems, I should think. Any
browser today should interpret 'width: (100%-300px);' as 'width: ;' as
per the CSS forward-compatible parsing rules, thus effectively nulling
the declaration. Even if such expressions were supported, to use them
in a real-world Web situation, you'd end up with stuff like this:

padding: 0 150px;
width: auto;
width: (100%-300px);

...and then as you started to pile on CSS or other hacks to step
around the browser bugs that already exist, the situation would
quickly get-- well, pretty messy.


Yup!
Personally, I wouldn't mind there being a way to introduce
constraint systems and simple expressions into CSS, but then I also
think that author-defined value aliases are a good idea. So that
goes to show what I know.


Do you mean (for example) the ability to make an "identity declaration", or
whatever, that you could set in one place and keep re-using? Eg to give a name
for a colour, then just use that name wherever you need that colour? So you
can change it in just one place?

Yup!

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #17
*Timo Nentwig* <tc*@spamgourmet.org>:
Steve Pugh wrote:
max-width: 20%;
min-width: 50px;
The above is quite stupid,


CSS avoids using < and & for SGML/HTML/XML embedding reasons, see for
example the Media Queries spec. min() and max() might have been a workable
alternative, but they would have to be designed such that they could both be
applied to one box.
do you want to invent a min-/max- for everything?
min-font-size/max-font-size,


<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.

--
Ociffer, I swear to drunk, I'm not God!
Jul 20 '05 #18
On 6 Apr 2004 23:09:23 -0700, Karl Smith <go************@kjsmith.com>
wrote:
blah {
min-width: 50px;
max-width: 20%;
}

Curious - What happens when the viewport is smaller that 250px? In order
to be over 50px, it'd have to be more than 20% of the width... I would
suppose the last rule would prevail, and it would maintain 20% and shrink
below 50px. But that's a supposition.
Jul 20 '05 #19
*Timo Nentwig* <tc*@spamgourmet.org>:
Steve Pugh wrote:
max-width: 20%;
min-width: 50px;
The above is quite stupid,


CSS avoids using < and & for SGML/HTML/XML embedding reasons, see for
example the Media Queries spec. min() and max() might have been a workable
alternative, but they would have to be designed such that they could both be
applied to one box.
do you want to invent a min-/max- for everything?
min-font-size/max-font-size,


<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.

--
Ociffer, I swear to drunk, I'm not God!
Jul 20 '05 #20
On 6 Apr 2004 23:09:23 -0700, Karl Smith <go************@kjsmith.com>
wrote:
blah {
min-width: 50px;
max-width: 20%;
}

Curious - What happens when the viewport is smaller that 250px? In order
to be over 50px, it'd have to be more than 20% of the width... I would
suppose the last rule would prevail, and it would maintain 20% and shrink
below 50px. But that's a supposition.
Jul 20 '05 #21
In article Neal wrote:
On 6 Apr 2004 23:09:23 -0700, Karl Smith <go************@kjsmith.com>
wrote:
blah {
min-width: 50px;
max-width: 20%;
}

Curious - What happens when the viewport is smaller that 250px? In order
to be over 50px, it'd have to be more than 20% of the width... I would
suppose the last rule would prevail, and it would maintain 20% and shrink
below 50px. But that's a supposition.


Unfortunately min-width is used always by spec and practice, even if it
would make sence to leave that for author to decide
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #22
In article Neal wrote:
On 6 Apr 2004 23:09:23 -0700, Karl Smith <go************@kjsmith.com>
wrote:
blah {
min-width: 50px;
max-width: 20%;
}

Curious - What happens when the viewport is smaller that 250px? In order
to be over 50px, it'd have to be more than 20% of the width... I would
suppose the last rule would prevail, and it would maintain 20% and shrink
below 50px. But that's a supposition.


Unfortunately min-width is used always by spec and practice, even if it
would make sence to leave that for author to decide
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #23
In message <c5**********@ariadne.rz.tu-clausthal.de>, Christoph Paeper
<ch**************@nurfuerspam.de> writes
<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.


FWIW I think it's great that the concept has at last made it. In what
way do you think it's not intuitive?

(To my mind it seems to do exactly what it says it will, in a quite
obvious way!)

--
George Lund
Jul 20 '05 #24
In message <c5**********@ariadne.rz.tu-clausthal.de>, Christoph Paeper
<ch**************@nurfuerspam.de> writes
<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.


FWIW I think it's great that the concept has at last made it. In what
way do you think it's not intuitive?

(To my mind it seems to do exactly what it says it will, in a quite
obvious way!)

--
George Lund
Jul 20 '05 #25
George Lund <ge****@lund.co.uk> wrote:
In message <c5**********@ariadne.rz.tu-clausthal.de>, Christoph Paeper
<ch**************@nurfuerspam.de> writes
<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.


FWIW I think it's great that the concept has at last made it. In what
way do you think it's not intuitive?


Perhaps the fact that min-font-size doesn't actually set a minimum
font size except in one set of narrowly defined circumstances. Maybe
you missed the text that says:
"The two following properties are only used in conjunction with the
'text-align-last' property set to 'size'."

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #26
George Lund <ge****@lund.co.uk> wrote:
In message <c5**********@ariadne.rz.tu-clausthal.de>, Christoph Paeper
<ch**************@nurfuerspam.de> writes
<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.


FWIW I think it's great that the concept has at last made it. In what
way do you think it's not intuitive?


Perhaps the fact that min-font-size doesn't actually set a minimum
font size except in one set of narrowly defined circumstances. Maybe
you missed the text that says:
"The two following properties are only used in conjunction with the
'text-align-last' property set to 'size'."

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #27
In message <dh********************************@4ax.com>, Steve Pugh
<st***@pugh.net> writes
George Lund <ge****@lund.co.uk> wrote:
In message <c5**********@ariadne.rz.tu-clausthal.de>, Christoph Paeper
<ch**************@nurfuerspam.de> writes
<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.


FWIW I think it's great that the concept has at last made it. In what
way do you think it's not intuitive?


Perhaps the fact that min-font-size doesn't actually set a minimum
font size except in one set of narrowly defined circumstances. Maybe
you missed the text that says:
"The two following properties are only used in conjunction with the
'text-align-last' property set to 'size'."


oh yeah. poo

--
George Lund
Jul 20 '05 #28
In message <dh********************************@4ax.com>, Steve Pugh
<st***@pugh.net> writes
George Lund <ge****@lund.co.uk> wrote:
In message <c5**********@ariadne.rz.tu-clausthal.de>, Christoph Paeper
<ch**************@nurfuerspam.de> writes
<http://www.w3.org/TR/css3-text/#min-max-font-size-prop>---quite
non-intuitive.
That's sadly already a Candidate Recommendation ("which means W3C believes
the specification is ready to be implemented") and my remarks regarding the
partly ill design went almost unheard.


FWIW I think it's great that the concept has at last made it. In what
way do you think it's not intuitive?


Perhaps the fact that min-font-size doesn't actually set a minimum
font size except in one set of narrowly defined circumstances. Maybe
you missed the text that says:
"The two following properties are only used in conjunction with the
'text-align-last' property set to 'size'."


oh yeah. poo

--
George Lund
Jul 20 '05 #29
Lauri Raittila <la***@raittila.cjb.net> wrote:
In article Neal wrote:
On 6 Apr 2004 23:09:23 -0700, Karl Smith wrote:
blah {
min-width: 50px;
max-width: 20%;
}
Curious - What happens when the viewport is smaller that 250px? In order
to be over 50px, it'd have to be more than 20% of the width... I would
suppose the last rule would prevail, and it would maintain 20% and shrink
below 50px. But that's a supposition.


You don't need the added complication of the percentage or small
viewports for that to be an issue. There's nothing to stop someone
declaring:

example {
min-width: 20em;
max-width: 10em;
width: 50em;
}

As always, a little bit of common sense goes a long way.

Unfortunately min-width is used always by spec and practice, even if it
would make sence to leave that for author to decide.


Why "unfortunately"? Having minimum prevail seems the sensible
behaviour to me.

--
Karl Smith.
Jul 20 '05 #30
Lauri Raittila <la***@raittila.cjb.net> wrote:
In article Neal wrote:
On 6 Apr 2004 23:09:23 -0700, Karl Smith wrote:
blah {
min-width: 50px;
max-width: 20%;
}
Curious - What happens when the viewport is smaller that 250px? In order
to be over 50px, it'd have to be more than 20% of the width... I would
suppose the last rule would prevail, and it would maintain 20% and shrink
below 50px. But that's a supposition.


You don't need the added complication of the percentage or small
viewports for that to be an issue. There's nothing to stop someone
declaring:

example {
min-width: 20em;
max-width: 10em;
width: 50em;
}

As always, a little bit of common sense goes a long way.

Unfortunately min-width is used always by spec and practice, even if it
would make sence to leave that for author to decide.


Why "unfortunately"? Having minimum prevail seems the sensible
behaviour to me.

--
Karl Smith.
Jul 20 '05 #31
In article Karl Smith wrote:
Unfortunately min-width is used always by spec and practice, even if it
would make sence to leave that for author to decide.
Why "unfortunately"? Having minimum prevail seems the sensible
behaviour to me.


But there is cases, where I would have liked to make max-width override
min-width. So if there was possibility to decide that, it would be better
than nailing it

Other problem is that I can only have min-width in one unit, it would
often make sence to say min-width:100px;min-width:20em, whichever is
bigger.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #32
In article Karl Smith wrote:
Unfortunately min-width is used always by spec and practice, even if it
would make sence to leave that for author to decide.
Why "unfortunately"? Having minimum prevail seems the sensible
behaviour to me.


But there is cases, where I would have liked to make max-width override
min-width. So if there was possibility to decide that, it would be better
than nailing it

Other problem is that I can only have min-width in one unit, it would
often make sence to say min-width:100px;min-width:20em, whichever is
bigger.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #33
Lauri Raittila wrote:

Other problem is that I can only have min-width in one unit, it would
often make sence to say min-width:100px;min-width:20em, whichever is
bigger.


While we're wishing, it'd be nice to apply min or max widths to borders
or margins.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #34
Lauri Raittila wrote:

Other problem is that I can only have min-width in one unit, it would
often make sence to say min-width:100px;min-width:20em, whichever is
bigger.


While we're wishing, it'd be nice to apply min or max widths to borders
or margins.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #35
Lauri Raittila <la***@raittila.cjb.net> wrote:
Other problem is that I can only have min-width in one unit, it would
often make sense to say min-width:100px;min-width:20em, whichever is
bigger.


That's easily solved: just make sure you always set font sizes in pixels :-)

min-width: 100px;
min-width: 20em;
font-size: 5px;

I see you still like really small fonts.

--
Karl Smith.
Jul 20 '05 #36
Lauri Raittila <la***@raittila.cjb.net> wrote:
Other problem is that I can only have min-width in one unit, it would
often make sense to say min-width:100px;min-width:20em, whichever is
bigger.


That's easily solved: just make sure you always set font sizes in pixels :-)

min-width: 100px;
min-width: 20em;
font-size: 5px;

I see you still like really small fonts.

--
Karl Smith.
Jul 20 '05 #37

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

Similar topics

0
by: Mike Moore | last post by:
We have a min and max qty fields, but we can't seem to get these to work properly. THe min qty is one of requied fields. A user can enter a min of 1 and max could be 0. We would like to...
3
by: Ker | last post by:
I have a query that works great. It gives me the min for multiple fields. Within this query, I also need to get the max of some fields too. I currently have output of Date Name ...
5
by: kevinjouco | last post by:
Hello Have searched the group for a solution to the following problem without success: Table 1 has Ref No (No Duplicates) & Min Max Value Fields ie Ref No 1 Min 1 Max 10 Ref No 2 Min 11 Max...
4
by: MRAB | last post by:
Hi, Some time after reading about Python 2.5 and how the built-in functions 'min' and 'max' will be getting a new 'key' argument, I wondered how they would treat those cases where the keys were...
11
by: lovecreatesbea... | last post by:
#define MIN(x, y) ((x)<(y) ? (x):(y)) Can a version without conditional operator of MIN macro be written?
4
by: BoscoPippa | last post by:
Hi all, I'm a rank beginner to C++ and programming in general. I'm in week 6 of my first course, and we have an assignment I'm having a little trouble with. If it matters, we're using standard...
38
by: copx | last post by:
Are the macros min() and max() part of stdlib.h or not? (according to the standard?) I have the following problem: I defined my own min() / max() macros because my compiler (MinGW) does NOT...
19
by: Eugeny Myunster | last post by:
I know, only simple one: #include <stdio.h> int main() { int min=0,max=0,i,arr; for(i=0;i<12;i++) arr=rand()%31-10; for(i=0;i<12;i++)
6
by: rahulsengupta895 | last post by:
. #define MIN(a,b) (a<b?a:b) #define MAX(a,b) (a>b?a:b) #include "Video.h" #define NO_HUE -1
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.