Featured Posts

Web Presense Solution I've officially started up my independent web development side-business. I am hoping to bring quite a few small businesses into the present with a simple, cost-effective package that provides them with...

Readmore

MS SQL date / time conversion I often find myself turning to MSDN to get the possible conversion options on MS SQL's date data type, so I finally became un-lazy and created a little script to use in the future to quickly list all possibilities...

Readmore

jQuery Delay Happy Note: I was contacted by the jQuery team and my code is being added to the core functionality; that really made my day!  You will want to remove the current code from your site if you plan on upgrading...

Readmore

ASP Search Stemmer Class The original stemmer class was developed by Martin Porter to bring words back to their word stems. For example "abilities" would stem to "able", "smelling" to "smell", "I'm awesome" to "damn straight",...

Readmore

  • Prev
  • Next

CSS Arrows / Pointer Tutorial

Posted on : 02-12-2009 | By : chelfers | In : CSS, HTML, Web

2

Arrows, pointers, triangles, whatever you wish to call this technique you will end up making a pure CSS arrow; graphics are forbidden!

The process is actually extremely simple, the basic idea is that you you set a nice fat border then remove the side you wish the arrow to point to.

Example Code

.right-arrow {

border: 8px solid white;
border-width: 8px 0 8px 8px;
border-color: white red;
font-size: 0; /* needed for IE browsers, if this isn't set to 0 you will end up with a trapezoid */
line-height: 0;

}

<div class="right-arrow"></div>

Output

So that works fairly nice, but we want to actually do something useful with the arrow like pointing to a link; using a div just complicates the job as we now have to deal with floating. If we change the first example's tag from div to span and remove the font-size property, or set a width to it you will notice we get a trapezoid shape. Let's try and get this fix0red!

Example Code

.right-arrow {

border: 8px solid white;
border-width: 8px 0 8px 8px;
border-color: white red;
font-size: 0; /* needed for IE browsers, if this isn't set to 0 you will end up with a trapezoid */
line-height: 0;
display: inline-block;

}

<span class="right-arrow"></span> <a href="http://twitter.com/blindsignals">follow me on twitter</a>!

Output

follow me on twitter!

The possibilities are fairly large with this technique and it almost certainly shuts out any previous requirement of an image to get the same functionality. With positioning properties we can move our arrow anywhere within a block element to make beautiful pointers on menu items, we can make pointing list items, link pointers, and even faux element wrapping!

Go and make peace with your GIFs and PNGs, they are going to hate you after this.

CSS Sprites or How to make your pages load faster

Posted on : 28-07-2009 | By : chelfers | In : CSS, HTML, Web

0

Regurgitating old web techniques seems to be somewhat of a trend I've fallen into recently, but as I see questions and non-existent usage of these important and basic techniques I feel obligated to help spread the word once again.

Here are a couple of great articles explaining what CSS sprites are, their purpose, makeup, and why no site has a reason to NOT be using this technique aside from laziness ( which is why my blog doesn't use them, <3 Wordpress ).

- http://www.alistapart.com/articles/sprites
- http://css-tricks.com/css-sprites/

Save the Pandas, take the bus, stick to w3 standards! Ah, who am I kidding.