Live data from Hacker News

A Single Div

a.singlediv.com

131–140 of 146 posts

Re: A Single Div

#131

Earlier quoted context omitted.

I believe Flexbox, which is supported by most major browsers, allows vertically centering content without hacks: http://philipwalton.github.io/solved-by-flexbox/demos/vertic...

http://caniuse.com/#feat=flexbox Until most IE users upgrade to 11, it's not usable by those of us who can't exclude a large chunk of our users.

The minimum threshold is IE10 since nothing prevents you from using the old spec which was implemented in that release:

https://gist.github.com/acdha/a91a46706de02c37566a

This is a little tedious but a CSS preprocessor makes it pretty easy and you only need to do it once for something this simple.

Since Microsoft is pushing automatic upgrades to IE11 hard for security reasons, I see over 80% of our users having a browser which supports flexbox. At that point, it's a manageable problem because you can deploy http://flexiejs.com/ for the people who are prevented by corporate policy from upgrading.

Re: A Single Div

#132
post #87
post #42

I haven't seen so much nay-saying on HN in a while. It's like because there's an artistic element this or it's pure-web tech the appreciation of a cool hack and interesting exploration of a technology is completely gone. This is a classic example of a "hack", pushing CSS slightly beyond what it was intended for and potentially what is practical. But it's beautiful and clever, and if you truly can't appreciate it, tha…

> But it's beautiful and clever, and if you truly can't appreciate it, that's sad. Interesting. Is it as sad as the fact that one still cannot vertically center a div in CSS without using elaborate hacks?

elaborate hacks? 'position:absolute;top:0;bottom:0;margin:auto;'

Re: A Single Div

#133
post #59

For those who don't understand. Each image is not in fact an image, it's css styles applied to a single html element. Very impressive. http://i.imgur.com/V8HYrhK.png

It's amazing how powerful css is. I recently worked with changing the checkboxes on a form of mine to look like the iOS7 toggle. Check it out: http://designcouch.com/home/why/2013/09/19/ios7-style-pure-c...

I once saw a jQuery plugin for something like that. Inspired me to make it with just CSS. The outcome is much like what you made.

http://jsfiddle.net/talmand/tb9NZ/

I now see that the jQuery plugin that inspired me now has a commercial license. I would have never considered monetizing something so easily created if you know how such things work. Granted, the jQuery plugin does have a few more features.

Re: A Single Div

#134
post #53

Earlier quoted context omitted.

I agree the novelty has worn off, but for someone who's trying it out and has done it for the first time - it's a pretty cool hack. Remember your first novelty hack?

I don't want to discourage people from playing around with CSS, or even from trying to make scrambled eggs with their hands tied behind their backs. It's good for people to challenge themselves in all kinds of creative ways. But this is supposed to be Hacker News . Making icons in CSS hasn't been newsworthy in a very long time, and I think it's lamentable that something like this is at the top of the home page while…

It might be hard to realize that not everyone who visits the site has been around as long as the site has existed. There's nothing wrong for old content to be revisited; either for new eyes or refresher for old.

Plus, I guess I'm sorry the masses don't find some articles as fascinating as you?

Re: A Single Div

#135

What happens if you turn the web standards and css time back on this: https://twitter.com/secutor/status/504591841447399424 Amazingly pictures how hard it is to develop anything cross IE platform...

I fail to see your point. I don't understand what these clever uses of CSS that may or may not be used in a production environment has to do with old IE development. It would be like complaining that developing the film from a digital camera shows the pain of painting realistic images onto canvas.

Re: A Single Div

#136
post #42

I haven't seen so much nay-saying on HN in a while. It's like because there's an artistic element this or it's pure-web tech the appreciation of a cool hack and interesting exploration of a technology is completely gone. This is a classic example of a "hack", pushing CSS slightly beyond what it was intended for and potentially what is practical. But it's beautiful and clever, and if you truly can't appreciate it, tha…

It's been done before (and posted here) http://marvelapp.github.io/devices.css/ Edit: Changed link

None of these devices are one div... http://i.imgur.com/IwhB56A.png

Re: A Single Div

#137
post #87

Earlier quoted context omitted.

> But it's beautiful and clever, and if you truly can't appreciate it, that's sad. Interesting. Is it as sad as the fact that one still cannot vertically center a div in CSS without using elaborate hacks?

There's a good reason for that. Traditionally, HTML layouts are not designed to specify any kind of vertical behavior. There is no "vertical" in HTML. How the interface works (your browser) and how it is used (up-down scrolling) naturally imposed a scaling on width, not on height.

I'm not sure why that's a "good" reason. It's possible to vertically center something using hacks and there are obvious use cases for doing so. The fact that CSS doesn't allow us to do so is a failing of the language, plain and simple.

Traditionally, people used tables for layout and tags for emphasis. That doesn't make it right, either.

Re: A Single Div

#138

What shitty fucking whiners you lot are. This is a fun technical experiment. It's clearly not advocating for some sort of production environment usage of pure CSS/single-div imagery in lieu of SVGs. It's a mental challenge and a fun "I wonder if" experiment. Any of you busily shouting high from the mountaintops how this is useless and pointless and stupid and derf, don'tyouknowthisisn'tpractical should stop well shor…

>a key tenet of a great engineer is occasionally looking at absurd challenges and seeing if they can make something happen

Sure, if that absurd challenge has some benefit to someone out there. This is not true for CSS-only artwork. There are no applications for this.

Re: A Single Div

#139
post #51
post #20

What is the point of doing that instead of using SVG?

It's a hack. Therefore it has been posted on "Hacker News". I come to "Hacker News" because I like seeing cool hacks once and a while. Don't you?

I wouldn't call them hacks. They follow the standard rules of CSS. I would call them creative.

Re: A Single Div

#140
post #53

Earlier quoted context omitted.

I don't want to discourage people from playing around with CSS, or even from trying to make scrambled eggs with their hands tied behind their backs. It's good for people to challenge themselves in all kinds of creative ways. But this is supposed to be Hacker News . Making icons in CSS hasn't been newsworthy in a very long time, and I think it's lamentable that something like this is at the top of the home page while…

I don't want to discourage people from playing around with snarky comments, or even from trying to make people feel bad with their hands tied behind their backs. It's good for people to challenge themselves in all kinds of creative ways. But this is supposed to be Hacker News . Making hypocritical comments hasn't been newsworthy in a very long time, and I think it's laudable that something like this is at the bottom…

OK, OK, point taken. I would have gone back and deleted my comments but it was too late.
Post reply on HN