Creating your own tool kit – Part I: CSS

May 27th, 2010

How many of you start every design from scratch? Meaning you will code your html and css from the beginning. If you are a beginner, probably quite a few. Which is a good thing, because that is how you learn your chops. I do it every once in a while, so I don’t forget things. Most of the time I am starting from a starter file I created. I have different versions of CSS files, depending on what I am building. At work, the one I made is very detailed, and can be because we follow a strict structure. It also helps because I consistently use the same id names, and when I firebug something, I know right away what the hell is going on.

Creating a file like this to be reused is just one of the tools web developers have in their “tool kit.” Things we have to speed up the time it takes to build a site. Tonight is part one in how ever many I decide to do. They won’t be consecutive, but spread out whenever I get one together. For my next one, I would like to do a base CSS file, but using Sass and showing the neat little tricks you can do with it.

Read the rest of this entry »

Cool CSS3 tricks…why I wouldn’t do it

May 25th, 2010

I’m back from vacation, so I’ll start light tonight. I’ve seen a ton of articles lately about CSS3 transitions and other craziness lately. “Check out this killer rotating, sliding, fade in, hover thingy with rounded corners and dropshadows coming out its ass thing I did!”

Here is an example…and just to note, I am in NO way dissing this person (Ahmed El Gabri) that did this. I think it is actually just plain awesome to tell you the truth. The fact that he took the time to do this is really quite something to behold. There is only one image in there, and that is the smoke to make the swirl effect in the coffee gradient.

Read the rest of this entry »

Vacation time…

May 20th, 2010

Hello all. I’ll be on vacation from today till Sunday, so there won’t be any posts until then.

Google Font API….holy AWESOME!

May 19th, 2010

Ok, for those of you who don’t subscribe to net.tutsplus.com, or haven’t heard the news, Google has released Google Font API Beta. You can watch the video tutorial by Jeffrey Way here.

Here is the quick and dirty of it though. This works in a the same way as @font-face does.

1) Go here (http://code.google.com/apis/webfonts/).
2) Click on font-directory beta button
3) Find a font you like and click on the ‘Click to embed…’ link
4) Click on get the code
5) Copy and paste the link tag into your document’s head

Example:

<link href='http://fonts.googleapis.com/css?family=Cantarell' rel='stylesheet' type='text/css'>

6) Add the font-family to the style sheet

Example:

h1 { font-family: 'Cantarell', arial, serif; }

And you are done.

This is in beta right now, so they only have about 20 fonts right now. So at the moment, I will still be using Fontsquirrel.com(http://www.fontsquirrel.com/) and @font-face. But once Google’s Font Directy grows, this will probably be my go to place for custom fonts.

jQuery junkBox

.text();
This method, without the value, returns the text within the matched element (stips out the html). With the value, it will insert the text into the element.

$('p').text('Hello from The Web Machine');

Things we do in the beginning that make us shake our heads now

May 18th, 2010

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');