473,573 Members | 3,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3133
Timo Nentwig <tc*@spamgourme t.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*@spamgourme t.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*@spamgourme t.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*@spamgourme t.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*@spamgourme t.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*@spamgourme t.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*@spamgourme t.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

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

Similar topics

0
1121
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 implement a rule in the validator that the min can't be greater than the max and the max can't be less than the min. What would be the best approach or...
3
6723
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 Min Start 9/1/03 Walker Rhines 7:00AM I also need Max such as Max End 3:00PM
5
2322
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 20 etc Table 2 is linked by Ref No (Allows Duplicates) & Recorded Value
4
4698
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 the same, for example: L = print min(L, key = len), max(L, key = len) The result is:
11
5003
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
13432
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 (?) C++ in our class, not ANSI/ISO. Anyway.... The problem is to do the following: 1. Ask for input of up to 10 numbers 2. Return the number...
38
42879
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 define them. When I tried to compile my program with lcc-win32 the compiler complained about macro redefinition, because min() and max() are defined in...
19
29233
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
6769
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
7687
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...
0
8017
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. ...
1
7777
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...
1
5585
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...
0
5290
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3731
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2203
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
1
1300
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1039
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.