Ask Håkon About CSS or...? 326
Back in 1994, while working for the World Wide Web Consortium (W3C), Håkon Wium Lie (pronounced more or less "how come") proposed the idea of Cascading Style Sheets (CSS). Got a CSS question? An Ajax question? Want to know why Håkon loves Free Software so much? Or something else, related or not? Go ahead and ask -- after checking some of the links above, so you don't duplicate questions he's answered in other interviews or in articles he's written. (One question per post, please.) We hope to post his answers Friday.
Idea? (Score:2, Interesting)
Re:Just one question (Score:5, Interesting)
Where... (Score:3, Interesting)
Opera (Score:5, Interesting)
Padding (Score:5, Interesting)
Why is CSS such a good idea but a pain to use? (Score:5, Interesting)
Why is CSS such a pain compared to other languages?
Data transformation a la XSLT? (Score:3, Interesting)
2.) Would it be crazy to have CSS incorporate data selection and assembly? (using something like XPath -- alowing more complete segration of data and formatting.)
Re:Just one question (Score:5, Interesting)
Two questions (Score:2, Interesting)
And another (Score:2, Interesting)
Re: Two questions (Score:5, Interesting)
1. What would you most like to change with CSS? That is, if you could go back in time and change one thing in the spec and have it reflected today, what would be the most important thing?
2. If you were allowed (perhaps by court order, which wouldn't be unthinkable) to force Microsoft to do one (1) change in Internet Explorer, what would that be?
As a bonus question: What do you think of Slashdot's CSS? ;)
Included styles, aliases (Score:5, Interesting)
(For includes) (For aliases) This way we could change colors or images for a whole webpage by editing a reduced number of lines.
Had you considered any of these ideas in the past? If so, why were they rejected?
CSS Evolution! (Score:5, Interesting)
Re:Padding (Score:5, Interesting)
Where do you think standards would be without IE? (Score:1, Interesting)
Re:Included styles, aliases (Score:2, Interesting)
as far as aliases, i would also love to have something like that in css. it would make it much more easy to organize your styles.
Horizontally aligning multiple items (Score:5, Interesting)
It's the main thing that's missing from CSS. Was it too hard to implement or write syntax for?
I'm thinking something like:
horizontal-align-to: .
eg: horizontal-align-to: #box middle top; Will align the top of this element to the middle of #box.
The same for vertical align would be nice as well. For horizontal elements restrict it to elements within a parent (and allow ID's (or use class name) to be duplicated within different parents, to make repeating multiple rows easier). For vertical it must be set on a block level element.
Alternate syntax:
On the reference element: horizontal-align-to: #name_me position;
On the to be aligned one: horizontal-align-from: #his_name position;
So:
horizontal-align-to: #rowman top;
horizontal-align-from: #rowman middle;
Will align the middle of the element, to the top of rowman.
About Microsoft... (Score:5, Interesting)
Re:Horizontally aligning multiple items (Score:4, Interesting)
Also the top middle bottom stuff, they should take an offset: eg: middle-10px; not sure of how to write that in good CSS sytax though. And baseline, and the rest of the aligners are legal as well.
equal column heights (Score:4, Interesting)
New standards (Score:5, Interesting)
Can you explain why W3C isn't sufficient, and why efforts at Opera to expand beyond the standards differ from Microsoft's embrace/extend model?
Re:Pronunciation (Score:1, Interesting)
Well, the latter is obvious. But you could make an argument for the "how" diphthong.
Most "å" letters in modern Scandinavian, including the one in Håkon/Håkan correspond to the "á" diphthong in Old Norse/Modern Icelandic. Which is pronounced as "au", just like "how". So the original (or Icelandic) pronunciation would indeed be more like that.
The diphthongs were lost from the rest of the Scandinavian languages somewhere around the 12th century. In a kind of odd twist, they were reintroduced into southern Swedish dialects later, making them actually sound a bit closer to the original in that respect.
Does CSS suck? (Score:3, Interesting)
http://www.decloak.com/Dev/CSSTables/CSS_Tables_1
"I pretty much want to kick whoever invented CSS in the nuts."
Misuse and Suggestions (Score:5, Interesting)
Re:Included styles, aliases (Score:1, Interesting)
Should CSS be a religion? (Score:5, Interesting)
I understand the impetus behind CSS, and think it has brought some nifty things to the Web, particularly in terms of integrating with the DOM and thus helping usher in all the AJAXy goodness we're seeing lately.
But CSS also seems to have spawned an anti-HTML jihad movement of people who rail against simple but effective HTML markup, including for example the B, I and FONT tags and the TABLE. Many people seem to make the principle of separating presentation from content a religious issue.
I learned HTML in 1994 by using the View Source command in Mosaic and Netscape (beta). The simplicity of the tags made it very easy. I could keep the basic structure of a doc in my head: "<html><head><title>Home Page</title></head><body><p>Hello, <b>world</b>!</body></html>"
For all the strenghts of CSS+XHTML, they are significantly more complicated to learn than basic HTML.
Do you worry that CSS is scaring off new Web writers, espeically since basic HTML is increasingly deprecated among Web developers?
Usability Testing (Score:2, Interesting)
HTML5 (Score:3, Interesting)
{Gack.} (Score:5, Interesting)
More programmically approaches of CSS (Score:3, Interesting)
ol#a *:first-child a:hover + dd, span#b *:first-child a:hover + dd {
Why is there no 'grouping' of selectors such as:
ol#a, span#b { *:first-child a:hover + dd {
And of course, there are more possibilities to greatly improve the maintainability of CSS-files; being able to define variables, or inline-calculations (eg. border-width: @var - 0.5em;
Have they not been included to keep CSS simple, or
Re:Why is CSS such a good idea but a pain to use? (Score:3, Interesting)
But there are cases where CSS cannot perform layout as well as tables. One of the reasons is because you can center a table that is sized to fit the content. In other words, in CSS you need to specify the size of the container in order to "auto" the margins so that it gets centered. But what if the size you pick is not perfect? What if the user changes the font size? If you set a container (like a DIV) to a fixed or relative width, then the user messes up the layout by changing font sizes, which might cause, for example, lines to wrap even though there's enough horizontal screen space to handle the larger size.
If you'd used a centered table without fixed size, the table would expand until there was no horizontal space before wrapping - that's the usual desired effect. Now, containers CAN size to fit their content if they're floated - but you can't float: center.
So one question is "You have float: left, and you have float: right... why no float: center?"
Luckily this is slashdot and I can ramble on endlessly...
Separating markup from layout and design is a wonderful idea, but CSS can't do everything that tables can do for layout (or it can't do it as well). The 2 and 3 column layouts, the so-called "Holy Grail" of web design, for example, can't be done as easily or as well (generically) in CSS as they can be done with tables (I'm not going to get drawn into an argument about it - I know how to do multiple columns in CSS, but problems with column lengths and the already mentioned problem of padding, margins, and borders not being included in the width cause problems you wouldn't have with tables).
Now, I know a lot of purists will insist I'm just whining, but doesn't that show there are a lot of shortcomings to CSS when sometimes markup actually does a better job of layout?
Re:Why is CSS such a good idea but a pain to use? (Score:4, Interesting)
Vertical centering is just as important. I want to be able to (without tables) place a 500x500 box center of the window without resorting to some wierd javascript to do it. You give me a div (or p) that does this in all browsers with zero javascript and I will be impressed.
The way I usually do it is with negative margins. It's kind of a workaround, but it does work. Position the div 50% from the top and left, and then give it a negative margin-top & margin-left equal to 1/2 its own height & width respectively (in the case of 500x500, use a -250px margin) and it should center vertically.
For example, I use something like this on one of my sites:
#container {
position: absolute;
left: 50%;
top: 50%;
z-index:1;
width: 500px;
height: 500px;
margin-left: -250px;
margin-top: -250px;
}
mixing inline and block elements (Score:4, Interesting)
Re:Question for /. (Score:2, Interesting)
I doubt it
As you can see from this graph [www.ssb.no], it's one of the most common names in Norway. (numbers on the left in percent)
Definition of pixel (Score:5, Interesting)
The word pixel meant "picture element", but CSS redefined it to mean something quite different (a particular subtended angle of view [w3.org]). This causes confusion: CSS pixels are not pixels. (Indeed, I have seen misinformed comments on Slashdot due to that confusion.)
My question is this: why call the subtended angle a "pixel", instead of something else (e.g. "subangle")? If CSS wanted to use the subtended angle for something, that is fine, but calling it a pixel seems to follow the approach of Humpty Dumpty—"When I use a word, it means just what I choose it to mean".
Re:Where... (Score:5, Interesting)
OK, here's my related question:
Do you think the W3C development process is too slow? I know that you guys want everything to be perfect, but it seems to take far longer than necessary. CSS 3 shows promise and I wouldn't want it to die a slow death in standardization.
Re:Padding (Score:1, Interesting)
CSS for table columns? (Score:5, Interesting)
Why isn't there any easy way to style a table column in CSS?
If you're serving legitimate, tabular data, and you want to right-align column #3 (normal for numerical data), you either have to apply a class to each cell, use javascript to apply it after the fact, or use hacks like:
Which work, but are difficult to maintain when you get 10+ columns, and don't try to automatically re-arrange columns with javascript.
Why can't we just place styles on a <col> or <colgroup>, and have it cascade down?
Re:Why is CSS such a good idea but a pain to use? (Score:5, Interesting)
I'd like to try to turn your observation into a more specific question:
CSS is clearly very useful for separating style from content. But apparently people tend to have problems when using it for layouts. Would you say this is because people have not yet understood how to properly do layout in CSS, or is it CSS that is lacking in this area? What can be done to improve the situation? --- Would the web benefit from HTML and CSS being complemented with some kind of "layout language"?
Your feelings on SVG? (Score:3, Interesting)
How do you feel about SVG (as currently specified, not as a concept)? What problems do you think it has, and why do you think those problems came about? If some other group (like the WHAT WG) were to rewrite it, would you support that?
Alternate Layout Paradigm (Score:1, Interesting)
My question is: how does one replicate the flexible layout ideas using CSS? I cant seem to figure out a good way to create `scalable` pages with HTML and CSS without the use of hacks. It seems like the Safari developers are giving `scalable` layouts some thought (ref: http://webkit.opendarwin.org/blog/?p=55 [opendarwin.org] and http://webkit.opendarwin.org/blog/?p=56 [opendarwin.org]). Em's and percents do make it work somewhat, but they dont cut it IMHO.
I understand that the popular use of bitmap (as opposed to vector based images) on the web is one of the primary reasons for non-scalable designs - but desktop applications with the flexible layout techniques seem to look much better on physically small screens with high resolutions.
I do like the direction SVG is going in, and hopefully IE will one day support.
CSS Parent Selector? (Score:3, Interesting)
My question has to deal with selectors: why doesn't CSS have a parent selector? All too often I find myself wanting to refer to a parent or a sibling of the current element but cannot (I'm sure there are a bevy of workarounds for individual cases...)
ie Why can't I do something like this to refer to a table row (given a structure of <tr><td><a>) a:hover:parent:parent { background-color: #cff; }? It's a simple example, but there really isn't a way to do this without involving a client-side scripting language.
Thanks for your consideration.
Nesting (Score:3, Interesting)
Was nesting ever considered? For example, instead of:
something like:
Also, do you think CSS3 is too complex? Some of it seems nearly impossible to correctly implement across browsers. Is there any consideration going in to the speed and complexity of rendering? I fear that CSS3 (and beyond) are beginning to play into the assumption that all computers will be Pentium 4's with 2 GB of RAM and plenty of clock cycles to spare.