Archive for the ‘CSS’ Category

Linking to stylesheets and favicons

Link to a favicon:

<link rel=”shortcut icon” href=”/favicon.ico” />

Link to a stylesheet:

<link rel=”stylesheet” type=”text/css” href=”style.css” />

Importing a stylesheet:

In the head section put:
<style type=”text/css”>
@import “import.css”;
</style>

Importing a stylesheet from another stylesheet:

In the stylesheet have:

@import url(import.css);


Link to stylesheet for Iphone:

<!–[if !IE]>–>
<link media=”only screen and (max-device-width: 480px)”
rel=”stylesheet” type=”text/css” href=”iphone.css”/>
<!–<![endif]–>

Link to stylesheet for a small broswer window (may or may not be Iphone):

<!–[if !IE]>–>
<link media=”only screen and (max-device-width: 480px)” rel=”stylesheet” type=”text/css” href=”iphone.css”/>
<!–<![endif]–>

Floats and keeping the height of a div

I had a problem today of how to keep the height of a div with floating elements inside of it.

I came across the solution of putting a div which clears both of the floating divs in the containing box using:

<div class=”clearfloat”></div>

and in the stylesheet:

.clearfloat {
clear: both;
}

This seems to do what I wanted.

For an example see here:

Floats and keeping the height of a div

CSS Theme Week

Don’t you just love CSS? Yeah!!

It’s CSS Theme Week at SitePoint. Don’t miss the CSS tutorials. So far they have had:

  1. Nifty Navigation Tricks Using CSS
  2. Breaking Out of the Box With CSS Layouts
  3. Warning: This Secret CSS Technique Will Surprise You!
  4. Fancy Form Design Using CSS
  5. CSS Positioning Properties At-A-Glance Guide

Now all I need is some time to read them!

CSS Layouts

Some great css templates as a starting point for you own design: