Skip to page content or skip to Accesskey List.
Search evolt.org
evolt.org login: or register

Work

Main Page Content

CSS tricks for branding

Rated 3.62 (Ratings: 7) (Add your rating)

Log in to add a comment
(13 comments so far)

Want more?

 
Picture of luminosity

Lachlan Cannon

Member info | Full bio

User since: October 13, 2001

Last login: October 13, 2001

Articles written: 5

Already on evolt.org, several articles have appeared about some basic uses of CSS. However, the strong capabilities of CSS to add an extra touch of slickness to a site haven't been fully touched upon. This article seeks to reveal some of the different ways degradable CSS can be used to add that extra something to the feel of a site.

Contents

Custom cursors

Internet Explorer 6 for Windows shipped with support for custom cursors, something which, once other popular browsers also take the initiative, will remove the need for web site authors to make their users download plug-ins to see custom cursors. The best thing about this feature is that using it won't break your site in browsers which don't support it, but instead make them revert to the default cursor. To use a custom cursor you must declare all the elements you want to use it on, for example, a link cursor in your <a> tags, and a text cursor in your <p> tags.

Trial versions of many different icon/cursor editors are available if you do not have one currently on your computer.

The following line of code is needed in your stylesheet to use the cursor: cursor: url("http://yoursite.net/customcursor.cur"); with the path of your cursor inside the url statement.

A word of warning: Make sure you know your audience before using these. Even if all you use them for is changing the cursor's colour to match your site's scheme better, some people are used to things exactly how they are and will panic at even such a small change as this.

Background Images

CSS allows for much more advanced control over background images than HTML, letting you change the attachment, position and whether or not it repeats. This extra control allows for powerful branding effects, such as the old design of Independents Day.

There are several properties in CSS to control the background of elements, all of which are available through the shorthand background declaration too.

body {
	background-image: url("mybackground.gif");
	background-attachment: fixed;
	background-position: top left;
	background-repeat: no-repeat;
	background-color: #FFFFFF;
}

All the keywords above can be specified in order after the background declaration too, as in background: url("mybackground.gif") fixed top left no-repeat #FFFFFF;. The possible values for background-attachment are scroll, fixed and inherit. Scroll specifies that it should scroll up with the page, while fixed says that the image should stay fixed where it is on screen, in other words that the image stays exactly where it is while the other content scrolls up, and inherit specifies that it should do whatever it's parent element was specified to do. Background-position can take a full list of position keywords, and percentage values. If you use percentage values, you should specify horizontal then vertical. Background-repeat can be repeat-x, repeat-y, repeat, or no-repeat.

Form Elements

Styling form elements is one of the more widely used applications of CSS. Invariably some questions pop-up again and again, and to answer them, no matter what z-index you use, some form elements will always show through, because the browser uses the O/S to render them, instead of doing them itself. Now that that's out of the way, there are many things that you still can do with form elements, using only simple CSS. Are you tired of that white background and 3d border? Background and border can help you out. Similarly, if you want your options to be different colours as you scroll down, you can make some classes and apply them to your options.

Stylesheets can help make forms adhere to your colour scheme, enhancing the feel of your site just a little bit further.

Custom List Pictures

One other nice trick that CSS enables you to do is custom list pictures. Custom list pictures are actually quite easy to use, as simple as list-style-image: url("myimage.png");. This can help you make lists better fit into the theme of a site, if used correctly. And if you need to use more than one, then it's quite easy simply by using different classes.

For example

ul.tv {
	list-style-image: url(images/tv.gif);
}

ul.comp {
	list-style-image: url(images/computer.png);
}

Born in Melbourne, Australia, Lachlan is soon to begin study at University.

Lachlan delights in being sent money, and other small gifts. But if you really have the money to spare ;) give it to something more worthy.

yeh cool heres some more

Submitted by parasite on January 24, 2002 - 04:33.

Use border-collapse:collapse; to get rid of those 3d borders on tables and forms, then set the width in pixels etc. This gives you a nice 2d border. One thing I like about cursors is using cursor: hand; for buttons, so when you mouse over a button the cursor changes to a hand. You can use css to control the entire look and size of buttons also (change font size etc, add padding and margins, colors). Just my 2 cents.

login or register to post comments

adendum

Submitted by luminosity on January 24, 2002 - 04:49.

Thanks for the comments, parasite. :)

I would like for everyone to be able to add their own tricks and tips here, for people new to CSS to be able to see. One thing about your code is that cursor: hand; is an IE only value, which they used because of a misinterpretation of the specs. the real value to use is cursor: pointer;, however because hand doesn't appear in any other declaration this is easy to fix.

cursor: pointer;
cursor: hand;

This way, Netscape 6, and the rest, ignore the incorrect hand declaration, while the versions of IE which don't know the proper use of pointer will simply use the hand declaration.

Come on everyone else, pitch in with your own tricks!

login or register to post comments

gee, thanks for that

Submitted by parasite on January 24, 2002 - 07:57.

Thanks luminosity, I'm so lazy I never bothered to figure that out myself. Cheers!

login or register to post comments

Neat Tricks are Good Times.

Submitted by haidary on January 25, 2002 - 00:53.

Hey guys. I for one liked the artical. A lot of people tend to forget that you can customize cursers with CSS. One nice yet simple trick I learned a while back is to dynamically change the curser by changing a className for the body tag. I can't seem to figure out how to change the curser directly in the style like you can... say... fontSize, so I had to do it this way. I uploaded an example to see what you guys think. If there's a better/easier way to do this, please let me know. Here's the URL- http://members.evolt.org/haidary/postpages/cyc/curser.htm

login or register to post comments

CSS Cursors

Submitted by tomreiter on January 25, 2002 - 04:00.

You should write: a { cursor: pointer; } Rather than: a { cursor: hand; } Becuase the later isn't in the CSS spec.

login or register to post comments

Re: Neat Tricks and Good Times.

Submitted by luminosity on January 25, 2002 - 06:40.

Thanks for your praise, haidary. :) I'm glad that you found this article interesting.

Your example of changing the cursor is nice, and after fooling round with IE for a few minutes, I can't figure out how to change the style directly, so unless someone else knows, it looks like that's a good approach.

login or register to post comments

Bad habit.

Submitted by haidary on January 25, 2002 - 12:32.

"You should write: a { cursor: pointer; } Rather than: a { cursor: hand; } Becuase the later isn't in the CSS spec. "
Duh....lol. Sorry about that. It's a bad habit. I usually set it to 'null' but I was foolin with it before I posted it. The reason I'm doing it with a function instead of a: hover etc., is because the function gives me better controll when it comes time to put it on a site. There are way more events.

login or register to post comments

scrollbars with all browsers?

Submitted by davezero on February 18, 2002 - 12:51.

I keep seeing these sites with tricked-out colored versions of scrollbars on them. We tried adding the css for them to the html part of the stylesheet, but I hear that currently this is a IE6-only supported technology and made some other browsers crash or act up. Any ideas on how to get scrollbars colored in other browsers? Dave Zero

login or register to post comments

Re: scrollbars with all browsers?

Submitted by luminosity on February 18, 2002 - 23:33.

Dave, these are a IE/PC 5 + technology only. You won't find anything about it in the specs, which is why other browsers won't support them, although there has been a recent rumour posted to thelist about Konqueror adopting them.

The reason I didn't include them in this article is because:

  • They're proprietary
  • They're only supported in IE.
  • They can be a major usability impairment, even to experienced users - I went to a site where the scrollbar was so dark that Icould barely see it to use it.

I wanted this article to show what neat things can be done with CSS, which can't be done with HTML layout, however although the scrollbars are controlled with CSS, I don't consider this to be a beneficial feature - I am in fact quite sick of seeing coloured scrollbars everywhere, which is why I now mostly use NS6.1 when I can.

login or register to post comments

Netscape and styling form elements

Submitted by rafiki on April 4, 2002 - 08:22.

Beware Netscape when adding CSS to form elements. NN4.x behaves badly when adding proportional fonts (Arial, Helvetica, etc.) to some form elements - INPUT, SELECT, TEXTAREA and OPTION. It will render these as a box instead of an editable field. The workaround? Use a fixed-width font such as Courier, Courier New or Andale Mono, not as pretty, but at least it's compatible.

There are also issues when adding a border to INPUTs. Remember that your buttons are INPUTs too and if you're using an image for your button, then the border will surround the image. In this case you need to either use a pseudo class INPUT:image {border:0px 0px 0px 0px;} or add the style inline in the tag itself.

login or register to post comments

Stupid Windows........ Cant get Cursor to work.

Submitted by TragicGod on May 10, 2002 - 08:52.

i tried the code above to change the cursor with CSS but it doesnt seem to be working. I even followed the link http://members.evolt.org/haidary/postpages/cyc/curser.htm posted above and copied that code EXACTLY. and still nothing but the "hand" when i mouseover something. I was also wondering how to set the cursor for the entire site, like in the body tag or something. Thanks as always.

login or register to post comments

trans cursor

Submitted by pawd on July 19, 2002 - 09:53.

When doing stuff with SMIL and Quicktime, you can use a transparent cursor. It doesŽnt really work well with CSS. If you need it to run It as a presentation on a dedicated PC, you can just overwrite the system cursor. I haveŽnt tried this with Mozilla, but It works with IE5.5/6. Well... at least tell your girlfriend about It !

login or register to post comments

Those colored scroll bars

Submitted by starlon on August 10, 2002 - 19:43.

Click here and get rid of them ;)

login or register to post comments

The access keys for this page are: ALT (Control on a Mac) plus:

evolt.orgEvolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.