Форум сетевых администраторов
Показаны 2 сообщений на этой странице

Форум сетевых администраторов (http://netadmin.ws/forum/index.php)
- Другие (http://netadmin.ws/forum/forumdisplay.php?forumid=19)
-- Dynamic CSS (http://netadmin.ws/forum/showthread.php?threadid=5213)


Помещено Tagore 22-04-2003 в 10:50:

Dynamic CSS

http://www.webamoeba.co.uk/general..../dcss.htm&id=20

DCSS

My biggest qualm with CSS is its lack of dynamics. For example, if I want to create a page where I need to give a number of table cells one or more border lines, I have to create a new style for each possible combination - linetop, linebottom, etc...

If CSS was more dynamic, I could create one style, line(top, bottom, left, right). Where a passed variable = 1 do X.

Admittedly it is possible to set CSS values in a tag and not apply a style or id. That's not very elegant though, and in an industry where elegance and ensured stability are key why shouldn't we demand more from our CSS? If HTML3 is OK why create HTML4? - did that just sound distinctly like a Mazda advert - rhetorical questions.

Implementation

Exactly how this would be implemented, I can't say, but here's a suggestion:

somestyle([vars]) {
('style')
[(var { 'style' })]
}

Lets run through that quickly:

" Declare style name - somestyle
" Setup variables to be passed - ([vars])
" Start definition - {
" Create a standard style to always be applied, regardless of the variables - ('style')
" Where variable 'var' is true apply the following style - [(var { 'style' })]
" End definition - }

So my previously annoying problem with the lines becomes much simpler:
style='line(1000)' - for a top line
style='line(1100)' - for a top and bottom line
style='line(0110)' - for a bottom and left line


Considerations

If my basic description of DCSS was taken up, my main concerns would be; 1. is it dynamic enough - is passing simple 'on/off' values enough 2. is my method of passing the values the best - brackets and 0 and 1 combinations.

Perhaps 'on/off' is enough, some how I get the feeling that it wouldn't take long before someone else was complaining about the lack of dynamics in DCSS. But maybe just the introduction of DCSS would lead to a whole new thinking pattern for styles and set off a DCSS revolution.

As for using 0 and 1s its the best I can think of right now. Then again, if being restricted to a maximum of 24 variables isn't a problem, then each variable could be a single letter. Where the letter is passed in applying a style then it is considered 'true'. So my lines example becomes:
style='line(t)' - for a top line
style='line(tb)' - for a top and bottom line
style='line(bl)' - for a bottom and left line

I also mentioned my concern with the brackets, although I can't see any actual problems with using brackets maybe it would be better to stick to a dividing character, such as the # used when defining id's of specific tags e.g. td#menu. Maybe a similar character could be used, a '+' for example.

__________________
Международное брачное агенство в Сибири.


Помещено Rumata 23-04-2003 в 22:39:

интересная мысль, но имхо не стоит изобретать велосипед: все давно сделано, например, в макроассемблерах. Тамошние макроподстановки хороши тем, что для них легко реализуются интерпретаторы и на них действительно вполне можно и удобно писать. При этом они все-таки не становятся новым языком, куда имхо метит автор статьи.

написал и подумал, а что мешает начать default.css со строчки типа:
#!/usr/bin/perl ?
Тогда все остальное не нужно. Имхо это лучший выход =))


Формат времени GMT. Текущее время 02:45.
Показаны 2 сообщений на этой странице

Powered by: vBulletin Version 2.2.4
Copyright © Jelsoft Enterprises Limited 2000, 2001.