News for hackers. Stuff that matters.
Re:PSD to HTML is Dead by elorant on Tuesday January 14, 2014 @12:18PM (#7058241)
As a developer I hope that CSS would share a similar fate sometime in the not too distant future. It’s freaking hideous, doesn’t work as it should and in order to build any decent modern site you end up writing something like 5,000 LoC. Nine out of ten times I want to do something with CSS I prefer doing it with JavaScript.
Re:PSD to HTML is Dead by thoughtpalette on Tuesday January 14, 2014 @12:19PM (#7058251)
"Nine out of ten times I want to do something with CSS I prefer doing it with JavaScript"

You're doing something wrong then.

Re:PSD to HTML is Dead by debt on Tuesday January 14, 2014 @12:47PM (#7058457)
center a div both vertically and horizontally to the viewport; also it should stay center when resized.
Re:PSD to HTML is Dead by thoughtpalette on Tuesday January 14, 2014 @12:49PM (#7058466)
Absolute Horizontal And Vertical Centering In CSS

http://coding.smashingmagazine.com/2013/08/09/absolute-horiz...

Re:PSD to HTML is Dead by debt on Tuesday January 14, 2014 @12:56PM (#7058524)
Truth. The div would need a variable height though which would change the design.
Re:PSD to HTML is Dead by proexploit on Tuesday January 14, 2014 @03:59PM (#7059679)
The page linked includes techniques for both variable height content (e.g. translate -50%) and fixed content.
Re:PSD to HTML is Dead by ptx on Tuesday January 14, 2014 @02:26PM (#7059118)
Although this used to be a problem with CSS, it has been fixed in modern browsers: http://philipwalton.github.io/solved-by-flexbox/demos/vertic...
Re:PSD to HTML is Dead by pjmlp on Wednesday January 15, 2014 @04:01AM (#7062330)
Now make it work across all browsers and operating systems required by your customer.
Re:PSD to HTML is Dead by elclanrs on Tuesday January 14, 2014 @07:53PM (#7060942)
You can use viewport units in modern browsers. See here http://caniuse.com/viewport-units
Re:PSD to HTML is Dead by minimaxir on Tuesday January 14, 2014 @12:21PM (#7058266)
When you have modern CSS frameworks like Bootstrap and Foundation available, the CSS aspect of a website is arguably one of the least complicated aspects of front-end development. (and better for the users instead of using JavaScript)

Even animations are easier to do in CSS due to CSS3 animation libraries.

Re:PSD to HTML is Dead by crimsonalucard on Tuesday January 14, 2014 @12:53PM (#7058498)
Err Bootstrap isn't a complete solution.
Re:PSD to HTML is Dead by minimaxir on Tuesday January 14, 2014 @01:05PM (#7058586)
Neither is HTML+CSS.

For a startup landing page layout, Bootstrap is more than enough. (see examples at http://www.blacktie.co )

If you want interactivity via AJAX/Angular, you'll need to include some sort of JavaScript of course, but that's outside the scope of the layout question.

Re:PSD to HTML is Dead by sp332 on Tuesday January 14, 2014 @12:50PM (#7058475)
Bootstrap is javascript.
Re:PSD to HTML is Dead by minimaxir on Tuesday January 14, 2014 @12:53PM (#7058507)
No it isn't. The majority of the Bootstrap framework is CSS. (there's an optional JavaScript component for advanced functionality)
Re:PSD to HTML is Dead by ptx on Tuesday January 14, 2014 @02:30PM (#7059137)
Maybe he's using Netscape 4, in which case CSS would also be JavaScript, more or less. http://www.netmechanic.com/news/vol4/css_no17.htm
Re:PSD to HTML is Dead by mintplant on Tuesday January 14, 2014 @12:53PM (#7058496)
Bootstrap contains some JavaScript for certain modules, but the majority is CSS (well, Less).
Re:PSD to HTML is Dead by sp332 on Tuesday January 14, 2014 @12:58PM (#7058544)
Ok, cool. But Less is also javascript!
Re:PSD to HTML is Dead by ben336 on Tuesday January 14, 2014 @01:58PM (#7058943)
No LESS is a stylesheet language that compiles down to CSS. Javascript isn't involved at all, unless you use their script tool to run uncompiled LESS in the browser. That is only meant for prototyping though, in production it will be compiled down to CSS.
Re:PSD to HTML is Dead by minimaxir on Tuesday January 14, 2014 @01:05PM (#7058592)
What the client sees is CSS, and that's the important part.
Re:PSD to HTML is Dead by sp332 on Tuesday January 14, 2014 @01:10PM (#7058619)
The important part for elorant (and me) is that CSS is awful to work with. And everyone in this thread is proving it by pointing out that you should use some kind of translation layer instead of actually touching it.
Re:PSD to HTML is Dead by pyre on Tuesday January 14, 2014 @02:01PM (#7058965)
Well, there's two things at play here. The complexity of the CSS model in the browser (plus all the browser-specific quirks) and the CSS syntax. Less only solves the CSS syntax issue.

My reading of this thread is that it was started based on the complexity of dealing with CSS in the browser rather than dealing with the CSS syntax.

Re:PSD to HTML is Dead by grey-area on Tuesday January 14, 2014 @03:01PM (#7059310)
CSS also has serious issues with its design (not just syntax) - it's a pretty awful markup language, because it was created apparently without reference to hundreds of years of graphic design and text layout and missed out some essential typographic and design concepts.

To pick a few examples, until recently you couldn't have grids, multiple columns of text (still pretty broken), embedded fonts, and the box model is unnecessarily complex, which led to loads of bugs in the browsers. That's easy to say in retrospect of course, and lots of the problems are now being fixed or worked around, but it's a pretty gnarly language, and many criticisms of it are not based only on ignorance but on substantial flaws in the original design. CSS is awful to work with, and is only slowly getting better.

Re:PSD to HTML is Dead by Bahamut on Wednesday January 15, 2014 @08:41AM (#7063251)
The slowness is largely due to competing interests & implementations by those interests. I don't think blowing away CSS completely would be a good solution - just look at the skepticism by many over Google trying to implement Dart in Chrome, and whether it'd be successful in eliminating JavaScript.
Re:PSD to HTML is Dead by grey-area on Wednesday January 15, 2014 @11:34AM (#7064252)
I don't think blowing away CSS completely would be a good solution

Sure, it's not all bad, it got off to a pretty flawed start, but has been steadily improving.

Re:PSD to HTML is Dead by Bahamut on Wednesday January 15, 2014 @07:34AM (#7062965)
It does suck to work with, but it is workable if you put in the time investment to learn it, just like any language. Nothing that justifies flat out incorrect statements/dramatic behavior.
Re:PSD to HTML is Dead by crimsonalucard on Tuesday January 14, 2014 @01:04PM (#7058574)
I agree that something is wrong with CSS. When you have to resort to hacks when making columns and vertically centering things... you know something is wrong.
Re:PSD to HTML is Dead by jbeja on Tuesday January 14, 2014 @01:29PM (#7058743)
Maybe vendors and browser fragmentation is what you are referring to?
Re:PSD to HTML is Dead by anentropic on Tuesday January 14, 2014 @02:02PM (#7058968)
no, CSS itself is a bit shit, that's why LESS and SASS came along
Re:PSD to HTML is Dead by jbeja on Tuesday January 14, 2014 @02:06PM (#7058985)
I wasn't talking about transpilers, i was referring to vendors support for every major browser.
Re:PSD to HTML is Dead by crimsonalucard on Tuesday January 14, 2014 @02:28PM (#7059131)
Does LESS or SASS fix the things I mentioned above?
Re:PSD to HTML is Dead by _a on Sunday January 26, 2014 @01:24PM (#7126110)
no :(
Re:PSD to HTML is Dead by johnjlocke on Tuesday January 14, 2014 @09:06PM (#7061231)
LESS and Sass compile to CSS.
Re:PSD to HTML is Dead by ChikkaChiChi on Tuesday January 14, 2014 @12:22PM (#7058271)
Can you provide any examples where using JS would be preferable to you? Maybe we can help?
Re:PSD to HTML is Dead by SDGT on Tuesday January 14, 2014 @12:27PM (#7058311)
> I want to do something with CSS I prefer doing it with JavaScript.

So now you're you're still writing css, but in JS files instead? Not taking advantage of shorthand transitions, keyframe animations, or :before/:after stylings.

SASS/LESS helps a lot (not to mention straight up frameworks like Bootstrap or Foundation), but what you're doing is even harder to maintain than structured CSS files.

Re:PSD to HTML is Dead by jsnk on Tuesday January 14, 2014 @12:20PM (#7058254)
Use Sass. Thank me later.
Re:PSD to HTML is Dead by bluetidepro on Tuesday January 14, 2014 @12:24PM (#7058287)
Or LESS! I personally prefer that over Sass.
Re:PSD to HTML is Dead by jbeja on Tuesday January 14, 2014 @01:30PM (#7058750)
Or Stylus.