Hacker Newsnew | past | comments | ask | show | jobs | submit | garand's commentslogin

Why do people do this?


Because single points of failure are a big KICK ME sign. http://bit.ly/ZwhmHB


Link shorteners are discouraged on HN. http://amyfelts.com/wp-content/uploads/2013/01/159580000x-ki... (It's just a cartoon of a "kick me" sign.)


Fo $


To solve the issue of z-index only working on positioned elements, what I do on all new projects is set the following:

  * {
    position:relative;
  }
This does two things. Allows me to set z-index values without hassle, and also allows me to set top/bottom left/right values.

Refer to my GitHub repo for the code for my base structure for new projects.

https://github.com/garand/base


I've learned never to add rules to the asterisk ever, after being badly burned on other projects multiple times.

At first glance, this rule appears more innocuous than others I've seen, because position is never inherited. (Unlike a font-size in a plug-in that broke every inherited font-size on the whole site).

But extra position:relative declarations can cause big problems on mobile browsers (including iOS6) when combined with CSS transitions. Don't ask me why, just browser bugs. I'd be extremely wary of any kind of global layout-fixes like this.


This does _three_ things: third is severely slows down page rendering.


I can't find any information about `position:relative` impacting page render performance. Please share.

Given my experience of low impact on render performance of vanilla properties like this (transitions are a whole 'nother story), I'm much more concerned with whether this is of benefit to developer happiness.

You'll never be able to use `position:absolute` for anything outside of the context of an element's parent, and opting out of this back to default behavior is much more painful than opting in with a better-scoped `.feature * {position:relative}`.

Every new developer will need to wrap their head around nonstandard page flow, and customizations like this have a way of accumulating into a very intimidating environment. As a general rule, I don't want to inherit anything silent and clever without very compelling reasons (* {box-sizing:border-box} passes this test because it makes so many things so much easier).


  You'll never be able to use `position:absolute` for anything outside of the context of an element's parent.
While true, I find that the instances that I need something to be absolutely positioned outside of it's context are few and far between. Also, it is quite easy to set position static on the parent elements.

  Every new developer will need to wrap their head around nonstandard page flow
I work with a team that is on board with this, so it hasn't been an issue yet.

Also, refer to this: http://css-tricks.com/things-it-might-be-funuseful-to-try-th...


position:relative is probably not that expensive, but the '*' causes very negative impact - the browser will scan the whole tree trying to match the rules every time the DOM changes.

http://minus.com/lyJrZzYj4bSoH


I used to think that as well, but after much research and using it on multiple projects I find that not to be the case.


It's a fact; look at this profile data for a simple test: http://minus.com/lyJrZzYj4bSoH

The '*' selector shoots up the chart, and for some reason the browser lays down a lot more rules then when it's absent. 2ms is not much, but when complexity increases it all adds up (games, client-side apps, etc).


Take a look at this.

http://paulirish.com/2012/box-sizing-border-box-ftw/

Specifically the Performance section.


I've read that, his argument is that "it's negligible", not that it doesn't have an impact. In his anedoctal evidence link it's adding 15-30ms to render times.

Add a couple * selectors - one in the reset, one more in your base sheet - plus a couple descendant * selectors, global box-sizing/position rules and you've put a heavy saddle on the matching and rendering engine. It might not matter for 80% of websites, but you need to be aware of it.


Do you use tables at all? What effect does this have on cells, rows, etc?


I haven't worked with tables and this much, so I can't speak for that.


Love it. Now all you need is something to crawl cloud app links and convert those.


Here's the old icon for anyone that want's it.

http://grnd.cc/LEbh


I must confess. I read this title as "MacBook Air".


It's fine to purchase a MacBook Air, you just really don't want to be one.


Glad I'm not the only one... This is hacker news, after all...


As someone who uses GitHub's web interface multiple times a day, the ability to dig down into specific actions and pages for a repo will save a lot of time clicking around. The big one for me, adding issues.


Ah, this makes a lot more sense to me now. Pretty cool!


Most users don't, but they have the ability to be swiped, and I've seen some iOS users swiping them around.


I'm seeing this. http://cl.ly/IMLf


I'm absolutely in love with my 2011 11" MBA. 1.8Ghz i7, 4 GB RAM, 256 SSD. The screen size is very conducive to focusing on one task at a time, periodically I will connect to a Thunderbolt display for added screen real estate.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: