
CSS tricks & tips
High quality
information about CSS tricks & tips, website promotion, meta tags and search engine optimization.
As you probably know, HTML offers us many commands that can be used to alter
the look and feel of a page. Headings, bold text, links, text that is bigger
or smaller than the text around it and so on. Naturally, the search engines
have noticed these features and adjusted their algorithms to match them.
For example, a word in the heading of a page usually tells more about the
contents of the page than a word in the body text of the same page, thus
the search engines give more weight to words found in the heading than in
the body text.
This creates some problems for the webmasters. For example, it's sometimes
impossible to add a H1 size heading to a page without ruining its outer
appearance. Every now and then, pleasing the search engine algorithm would
require you to add a link to a page, but you really wouldn't want to encourage
your visitors to leave your site.
These things are usually solved, if they
are solved, by cloaking the page. The problem is that cloaking takes plenty
of work and sometimes money. If there are only minor visual changes required
in order to please both the search engines and the visitors, cloaking seems
like a bit heavy solution for the problem.
Fortunately, as technology has developed, HTML has gotten an add-on: CSS
scripting language. CSS is used to alter the visual representation of pages
and as such is very useful in fooling the search engine spiders, especially
when placed in a separate file and then called from the HTML. While search
engines ignore these external CSS files, nearly all browsers support CSS
to some degree.
TheCounter.com's
statistics for September 2001 showed that over 95% of their visitors used
browsers supporting CSS at least to a some degree (IE3 or later, NN4 or later).
This means that by using CSS, you can currently offer somewhat different
content to the search engines and the visitors. Although CSS does not offer
the same amount of flexibility as cloaking (for example, the actual textual
content of the page cannot be changed with CSS), it is well-suited for solving
the small problems otherwise left unsolved.
You should however keep in mind that while an overwhelming majority of browsers support CSS, a lot of them
don't support all of its features. To avoid nasty surprises, it is best to
check your pages in both NN4 and IE4. As later versions of these browsers
have better CSS support, you'll be safe if your tricks work in the 4's.
What can you do with CSS tricks?
CSS can be used to hide text, but since humans can still pretty easily find
the hidden text even if hidden by CSS, I wouldn't recommend using it for
this. It is way more useful in fooling the search engines to think some parts
of your text are more important than they actually are. With it, you can
create links that do not look like links to anyone else but the search engine
spider, or H1 headings that look like your body text or smaller! Bold text
that looks bold to the visitor, but not to the engines? The other way around?
The possibilities are huge. By using CSS features, you can optimize your
page without sacrificing too much of your site's outer appearance.
Notice that this thing is a potential danger. Like cloaking, using CSS to
manipulate your page in order to rank higher on the search engines may get
you into trouble. When used for normal purposes, there is no risk of getting
punished by the search engines for using CSS. However, the CSS tips I'm going
to give to you go way beyond the normal usage and they have no other use
than to help you fool the search engine spiders, making search engine promotion
easier.
While I haven't yet heard of anyone that has been banned for using
CSS to manipulate his pages, there's always a (small) risk with this kind
of stuff. So, before altering your pages, make sure you're ready to face
the possible consequences and do not blame me if you get in trouble by playing
with this stuff (although I'd be happy to hear from it if someone manages
to get banned from using CSS). Also notice that times change - what the search
engines cannot do today, they might be able to do tomorrow. If the use of
CSS in optimization becomes very wide-spread, it is possible that the search
engines will develop techniques to read and interpret CSS, rendering this
technique useless.
If you're willing to accept the risks, you probably want to know how it is
done. Well, first you must learn CSS. Some good places to do that are
HTML Help's CSS tutorial
section and
House
of Style's CSS tutorial. After understanding the basics, you'll probably
understand what to do and how to do it. But if you want some ideas or want
to see what can be done before learning yet another (albeit easy) scripting
language, check out the simple CSS tricks page
I've made for your pleasure.
Minimize your risk
If you're planning on starting to seriously play with this, I recommend that
you use only external stylesheets that are linked from the HTML, just like
on my example page. Don't forget to create a robots.txt file that forbids
the spiders to grab the external CSS file. Although most spiders usually
ignore external CSS files, at least Inktomi has on occasion requested and
indexed them, so it's better to be safe than sorry.
It is also preferable
to use as much
HTML
element selectors as possible (ie. specifying that all H1 headings should
be no larger than regular text) instead of
class
selectors that force you to insert 'class="classname"' definitions in
your HTML code. These are just precautions and you will probably do fine
even without obeying them, but in the long run, they might save you from
a lot of headache. The example page I've created doesn't completely follow
the last rule and relies heavily on class selectors used together with the
HTML tag SPAN. This is a direct result from the need to show-off different
tricks. If possible, try to avoid the structure used in the example.
|