Sometimes its hard to write blog posts, because nothing inspiring pops into my head. Didn’t get to actually learn anything tonight, which sucks, but I will be on a mission tomorrow to do just that. Anyway, a thought came into my head as I was staring mindlessly at my keyboard. “Wow…remember when I tried to do THAT the first time? God I was an idiot!”
We’ve all had those moments. One of mine was getting things positioned using ‘relative’ positioning. I won’t go into the details, of how dumb I was, but lets just say I had my top margins at -500px or something silly like that. Now I know that you have to position relative the parent div and absolute the one you need to place with pin point accuracy using top and left. All browsers then get along.
Another…the float. I used to float the HELL out of divs, when it was totally unnecessary. I mean EVERYTHING. Stupid, stupid, stupid. Yes I could get things to work, but man what a pain in the ass.
Or how about dealing with IE6′s double margin? I used to write a separate rule for each margin that had a a left or right on it for IE6, when really a display: inline will work just fine.
You know when everything got real easy though? Using a css reset. I remember doing a site that had a bunch of ul’s on it, and they were all different. My css was disgusting. Everyone of them had seperate padding and margin rules and all sorts of crazy was going on. If I had just reset them all to 0, and then adjusted what I needed…wow.
So what are some things you have done that makes you shake your head and want to slap yourself? I know there are a ton more that I’ve done. But really, that is the point of this blog. To help the new and middle level web developer skip through all the crap I’ve gown through. I wish I had the resources available to me back in the day, as everyone does now.
Oh, and if anyone has a freakin’ link/site that shows how to start from ground zero to getting a web page up and going using Ruby, PLEASE give it to me! I talking about a for dummies type approach.
jQuery junkBox
.prependTo(target);
This method will return matching elements and add them to the beginning to the target. So, below would add an h1 tag to the beginning of the tag with an id of ‘container’
$('h1').prependTo('#container');