Are We Taking CSS Too Far?
blog.echoenduring.com
blog.echoenduring.com
Obviously, it's vital that both those features be possible.
But it's not obvious to me that those features be required in all markup; on the contrary, it seems far more useful for there to be a standard, predictable strata of functionality that developers can target with compilers.
From that perspective, the ability to do pure-CSS buttons and icons is a win. It's hard for a web developer hand crafting markup to apply CSS buttons, but it's trivial for a developer using something like Sass to get a button as a oneliner.
I'd sacrifice 10,000 extra lines of line noise markup in every design if it meant I never had to open Photoshop.
<a href="#"><div class="mybutton">Button</div></a>
.mybutton {
padding: 10px 5px;
border: 1px solid black;
background: red;
width: 100px;
text-align: center;
}
Instead of a gradient background and rounded corners, which is still trivial to write by hand.CSS is not designed for assembly of vector graphics, we have SVG for that. SVG is a well defined and logical format for web vector graphics. The ideal case would be Firefox and IExplorer implement embedding SVG graphics with <img> to catch up with Opera\WebKit. Also since SVG is xml based any web app could also probably implement dynamic generation and cacheing for bizarre use cases.
I always assumed these were experimental of the "just 'cause I can" type. Trying to show off how far CSS can go, but not really in a realistic usage.
I read here though that people believe this is a useful type of use. Without getting into a flame-war if it is or isn't, I think the answer there is SVG: that should be just perfect for these sort of usage.
2.) convert image.svg image.png
3.) Profit
Sometimes if I want a simple GIF knocking up, it's quicker to open vi and write the SVG, then use imagmagick to convert to GIF, than it is to open a proper paint program.
Anyway my point was only that SVG will solve this problem soon (say a year or so).
Pragmatically speaking I don't mind CSS animations as much since they can do things that are non-trivial to pull off convincingly in JS, e.g. 3D transforms. I also understand CSS animations are, or imminently will be GPU accelerated too.
transformations in CSS (display concerns), animations in JS (behavioral concerns)
WebKit went ahead and did both...
Or Content-type: text/hyper-postscript?
If you were going to do this.... I would probably go with something more persistent in a protocol (more X windows than http). Flip the axis (0,0 top left) and ... well a lot of things from display postscript ... might be fun,
But we can do that just as easily today.
> Would the web have been here if the net port restricted like it does today in the days of gopher?
There are very little port restrictions. The only ones that I am aware of that are routinely enforced are http and mail servers running on end-user lines and mail server other than the ISP ones connected from those lines.
Anything else is fair game.
> f you were going to do this.... I would probably go with something more persistent in a protocol (more X windows than http). Flip the axis (0,0 top left) and ... well a lot of things from display postscript ... might be fun,
Display postscript is a very impressive language, it takes some getting used to though.
But it is a lot more flexible and orthogonal than HTML will every be.
(Before you say "Ewww, PDF", recall PDF is basically Postscript, and most of the reasons you would say "Ewww, PDF" would still apply. I did say "most", there are some exceptions. Now, if you want to say, "Ewww, Adobe", I'm right there with you.)
You'd probably want to write in some other language or tool and use Postscript as an object language, like in the day of printers.
The huge difference is that the evolution of the media would be in the hands of the content creators, not the browser writers/choosers.
I would try this fork of the multiverse.
At least, that's what NeXT had to do with their Display Postscript. Prior to that it was possible to email someone a postscript file which the WindowServer would try to render for display in the mail window. One such file that went around would, when you clicked on the email, grab all your windows, spin them around the screen, and throw them off.
That's harmless, but Display Postscript included file operations...
Delegating an area of display would also need to be part of the security model to support things like third party ads.
Ah, the details…
(Note: I think PostScript, and stack-based languages generally, can be great fun, but really not for the average “guy making a site about his dog” sort of user)
You say that like it's a bad thing.
While this was very powerful and hugely entertaining from a geek perspective it was never going to be suitable for a wider audience - primarily due to the nature of PostScript itself. Don't get me wrong, I really liked PostScript as a programming language, but you have to admit that it isn't something that most people would be happy working with.
However, if you wanted scripted behavior in your generated documents then things could get interesting.
Often multiple http requests are avoided because browsers only make a limited amount of requests to a server at the same time. The best way to fight this is with image sprites and css source files stored on another server. I believe a simple sub domain would be enough to trigger more requests at the same time. Something like files.domain.com that even points to the same site as www.domain.com should do the trick. Load your site from www. And css/images from file. Subdomain.
data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOCAYAAAAWo42rAAAAAXNSR0IArs4
c6QAAAL9JREFUKM%2BNkE2KhDAUhMvMUoQQyCK6yE30Jp5C5LmbC%2Bkm5E
Au9BDZ1Cy604Md%2BqegoEg%2B3ksFvCulRBGh957ee4oIU0r5mshBRAjg4
mVZStA5V4DOuQeocFdVVXiWUuo%2F5zCOYwFezp7LWGtprS3KVCSJL%2FRY
va4r%2Br6HMQbGGAzDgG3brqunaSoaZ8%2FzfPueEMJLKDvGyJ%2FjOH73f
X%2F7vvM8gbquP05smoZKa%2F2xsdYaCCGwbduX07quY4yRf337vKb8xjnB
AAAAAElFTkSuQmCC
After base-64 encoding and including whitespace, it's still only 408 chars for the PNG.I agree with the author about the slightly over-the-top usage of CSS to make graphics - but what bothers me more is the fact that IE may either fail to render your creations properly (c.f. http://bit.ly/aqv6jT from the article), or make perhaps better alternatives (like SVG) unecessarily painful.
I don't think SVG is dead, I think it's getting closer and closer to the point where people will actually be able to start using it as was intended. Not quite there yet though.
The right tool for the job, and other such anecdotes.
(You know. In the absence of a hammer)
CSS is about facilitating graphical display, it's not about creating the graphics themselves.
I think that's a good point. I'm quite shocked to see someone's pushing CSS Icons as an actual solution to a problem - what next, CSS video? It's possible (an absolutely positioned div for each frame, and then just cycle the z indices to animate (perhaps even sans-js using :hover!)), and would be a lovely thing to hack around with, but as a serious "let's deploy this"? Whoa there.
That's taking CSS too far.
And the time you claim to have gained by not having to fire up photoshop and knock out a few simple buttons, you'll lose again by having to test in different browsers. Also consider readability, maintainability, future-proofing your code, semantic html.
edit: and if the ability to autogenerate arbitrary buttons is important, knock up a server side script to create the graphics for you. Really. That's much nicer than doing it in CSS for all but the simplest of cases.
I dont understand how you can possibly think generating text inside images to be more readable or semantic, future proof or maintainable.
nor do I understand how you think things creating generating images programatically on the server is easier or nicer than coding up a a .btn class
the cross browser issues might have some possible point, but in reality most people are just going to be copying and pasting from someone else who has worried about these things (I regularly copy and paste the css from gmail buttons)
> generating text inside images
oh, nonono, I was thinking more in terms of INPUT.button{background-image: url(btn.php?button_attributes_in_json);}
> adding an icon inside a button is far simpler with css buttons
depends what wonderful CSS you're using to create your button.
> generating images programatically on the server is easier
you say 'programmatically' like I'm suggesting something beyond taking a few pre-made slices and combining them into one image before serving it up. I'm not.
heh its not "hard", but its already a hell of a less convenient than what I just do now with css.
with css you do it once and its pretty much already automated, you just add a class to each "discount" or "tag" button you want.
On a side note I really despise the "you are doing it wrong" meme, it virtually always means "you arent doing it with the same concerns I have".