Posts Tagged ‘CSS’

Getting border-radius to work in IE

Tuesday, July 27th, 2010
Getting border-radius to work in IE

Border-radius on IE? That is just crazy!

It’s funny how many things from my job come up as posts. Well, I guess not funny, because I end up working on things that I am not familiar with and have to fix. Which is the case tonight. I’m not sure if you have read any articles, but there are plenty, about getting the CSS3 property border-radius to work in IE. It is actually rather easy, so let’s get to it, and I’ll show you how!
Actually, I’ll tell you how. And then I’ll tell you some of the troubles I ran into.

Wait, that’s it?

So getting your rounded corners is pretty damn easy. There are three things you have to do:

1) Go here and download the htc file.
2) Place the downloaded file in your images folder
3) In your CSS file, on the style that you want the rounded corners you add something like this:

(more…)

How to control CSS3 Radial Gradients

Friday, July 9th, 2010

Finally, something not so outrageous using CSS3 that we can all understand

I got a link through twitter about a raindrop done using CSS (don’t bother looking at this in Safari or Chrome, because he write the additional CSS for that). Normally this is the kind of thing that I will look at and say cool, but waste of time. This one caught my eye though because it is actually pretty simple. I’m not going to recreate the damn thing, but all it is, is a bunch of divs and a surprisingly small amount of CSS. I was actually impressed with this one, and I think it could have been done with just an ul and list items. Now, I would still use an image in a real life situation, but I picked this piece because I did not really know how to use the new gradients. This guy obviously does.

Learnin’

That led me to do some small bit of research and tests, and found it is not all that hard, just slightly confusing to get a grasp of what the numbers do. On top of that, the CSS Safari uses to do radial gradients is pretty different.

Some things to note about Safari while doing my demo. I could not get it to recognize percentages for the values in the border radius, so I had to do pixels. I’m not sure it can or not, and I didn’t find anything about it. Safari 5 does not need -webkit- in front of border-radius – it will still use it, so I would include it anyway to support the older versions.

If you look at the demo, you can see a div with a basic radial gradient, with rounded corners set to 100% in FF, and 300px in Safari. This should appear as a circle with red in the middle, then orange fading out to yellow. The second, is just to show you something easy to do with it. It is a png with the word GRADIENT cut out of it, and a drop shadow layer style put on. It then has a div behind it with a radial gradient, which if you ever wanted to change the colors, you wouldn’t have to use photoshop to do it. Just change the CSS!

Click here for demo.

(more…)

CSS – Hacking the hell out of browsers

Tuesday, June 29th, 2010

I’ve done small posts when I started doing this blog a while back, that included tips on how to hack certain browsers with CSS. I thought it would be good to list them all in one spot. I have been thinking of writing a small e-book that included all the things I have learned that I wish I knew from the start. Kind of like a super crash course in web development. Most of the things I write about, are things that would have been useful to me when I started out, but took a lot of time using google, reading, and just plain trial and error. I like to think I’m helping new web developers/designers get a kick start in their learning, and get ahead of the curve, which is what keeps me going. I actually really like mentoring new to intermediate web devs, and that is what keeps me writing this blog. Besides that, I actually end up learning more myself.

There are things that have to be done to make sure your site works in all browsers, and sometimes that means you have to do some things in your CSS to make sure everything is nice. I am going to show you the major methods of how to what we call “hack” a css file so that the browsers display the same thing. Let it be known, that it took me a while to be able to design a site without worrying about IE6. At the start, concepts of float, how margins and padding work, and other such things can be very confusing. I did a lot of hacking in the beginning before I knew how to build a site correctly. It would be great if you could just write the CSS and it all worked perfect, but even now, every once in a while, you have to do some fiddly things to get the older IE’s to cooperate. Let it be known, that I use the IE6 one quite a bit for image replacement, and if you do use these, you actually should put them in a seperate IE stylesheet. For getting things up and running quick though, I keep them in the main CSS file until I am done, and then take them out.

Now onto hacking!

(more…)

Inserting new elements with jQuery…and a CSS3 tip!

Wednesday, June 9th, 2010

Let’s start with a cool ass CSS3 tip. I can’t claim credit for this, as I just watched a video of it over at Nettuts+, done by Jeffery Way (my favorite tutorial creator), which you can watch here if you want. But it is really simple, so I’ll give you the gist of it right here.

Ever do image reflections? If you build enough sites, you most likely have. You know what I’m talking about, right? You have an image, and a copy of the image is flipped vertical below it and faded out so it looks like it is a mirror image? Well, you can do that using only CSS3 now, but be aware, as of right now, it only works in Safari and Chrome. I really hope this one gets to Firefox soon, because I have to do this effect often enough where this would make it easy. Here is the CSS:

-webkit-box-reflect: below 4px - webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(.7, transparent), to(white));

This is all one style, meaning it is not divided into multiple lines. You would put this on an image, and here is what all that crazy does. Obviously it reflects the image, below the original with a 4px gap between them. Adds a linear gradient to the reflection from top to bottom, starting with no color (transparent) and going to white. The color-stop number is how much the reflection shows. And that is it! This is actually one “cool” effect that I actually have a use for. Congrats to Safari/Chrome for getting this into their browsers…now get Firefox on the job.

Now, on to the jQuery!

(more…)

Test driving Sass 3…a second look at Sass

Wednesday, June 2nd, 2010

Sass logoSoooo…I have decided to try my hand at updating my install of Sass to version 3. I’m just a simple cave man…but I do know one thing. THAT was a bitch. I am stupid when it comes to command-line stuff. I literally have to do a google search on everything that I try to do. I have 10 windows open at the moment and each one is something dumb. Like how to change directories, how to update a damn gem, how do I update compass, how do I recompile with compass….COME ON!

Whew! Its done. And it works. Thank GOD! Now first I am going to give you a link to the test page I am building (using the html from my “Creating your own tool kit – Part I: CSS” post).

Click here for the demo.

Let’s take a look at the Sass first. Keep in mind, this is basic Sass stuff, but I want you to see the cool factor. Sass 3’s main syntax is SCSS (Sassy CSS). It is more closely related to CSS than Sass 2 was.

NOTE: I wrote an article a while back about Sass, but that was using version two’s syntax, so I am basically starting over.

(more…)