1. Font CSS Substitution Methods

    September 2, 2009 by J.P.

    font-image

    Many new methods of font substitution are coming of the wood work and old methods are now getting a second look.

    @font-face method

    The @font-face method was added to the CSS2 spec but then not recommended in CSS2.1. However with CSS3 it’s back and supported by most popular modern browsers. Read about @font-face at W3.org.

    This method requires the font being loaded on the server and will cause a slight flickering of the font rendering while it is stored in the cache. The plus side of this method is it’s easy to implement and requires no JavaScript.

    Here is an example of @font-face being used. Click Here

    Sample CSS code used (Note: font is stored on the server)

    @font-face {
    font-family: 'BrushScript';
    src: url('BrushScript.ttf') format("truetypefont");
    }
    /* for IE */
    @font-face {
    font-family: 'BrushScript';
    src: url(BrushScript.ttf);
    }
    body {
    font-family: 'BrushScript', helvetica; /*degrades to a standard web font if unavailable */
    font-size:1em;
    }

    Cufon JavaScript Method

    This currently my personal favorite method. No font is stored on the server and there is no flicker of the font while loading. The wizard also provides many options and settings so you can customize the needs for your site.

    Easy to add

    Cufon provides a simple method for converting fonts on your local machine into a js file that you include in the header along with the Cufon script. A simple replace call is used to substitute the font. Read more about Cufon here

    Example of the Cufon Method »

    Example Header Code

    <script src="cufon-yui.js" type="text/javascript"></script> <script src="AGaramondPro_400-AGaramondPro_700-AGaramondPro_italic_400.font.js" type="text/javascript"></script>
    <script type="text/javascript">Cufon.replace('h1');Cufon.replace('p');</script>

    Background Image method

    This method is good for replacing a few headers and best method to use with the logo of your site. Detailed px to px cross browser look with the design is needed while the code remains semantic. This method has been implemented in this version of my site since for major section H1 headers and the logo of the site.

    XHTML Example Code

    <h3 id="Portfolio">Portfolio</h3>

    CSS Example Code

    h3#Portfolio
    {
    background:url('/portfolio/2009/gfx/title_portfolio-trans.png') no-repeat;
    text-indent: -9999px;
    width:229px;
    height:61px;
    }

    This will work with all browsers. A list will be added shortly of the other methods and their support.


  2. CSS Attribute Selectors

    August 20, 2009 by J.P.

    computer_controls

    CSS Attribute selectors are a great way to target specific elements in your page and apply styles to them with out have go back and opening up the template file and changing code.

    I find them extremely useful for creating form css.

    There are 6 different types of attribute selectors

    • [att=value]
      The attribute has to have the exact value specified.
    • [att~=value]
      The attribute’s value needs to be a whitespace separated list of words (for example, class=”title featured home”), and one of the words is exactly the specified value.
    • [att|=value]
      The attribute’s value is exactly “value” or starts with the word “value” and is immediately followed by “-”, so it would be “value-”.
    • [att^=value]
      The attribute’s value starts with the specified value.
    • [att$=value]
      The attribute’s value ends with the specified value.
    • [att*=value]
      The attribute’s value contains the specified value.

    Here is an example page where I have formatted elements with attribute selectors only.

    Sample CSS Used

    <style type="text/css" media="screen">
    p[tile='para1'] {
    color:red;
    }
    input[type="text"] {
    width: 200px;
    background-color: #DDD;
    border:0px;
    display:block;
    padding:3px;
    }
    input[type="submit"] {
    width: 200px;
    background-color: #000;
    border:0px;
    display:block;
    padding:5px;
    color:#fff;
    margin-top:5px;
    }
    a[href$='.jpg']{
    background:green;
    color:#fff;
    }
    </style>


  3. BluePrint CSS Framework (Updated)

    June 1, 2009 by J.P.

    blueprintRecently been reading alot about CSS frameworks that are working off a grid that are easy to use and work with… Sort of been mulling around with trying one for my next project. After reviewing a few of them from this post. I’ve decided to give BluePrint a shot.

    BluePrint seems very easy to work with. It’s just the matter of how best to work with the framework while adding custom content around it. view the test pages here that come with the default install. Pretty nice grid working cross browser. (Update) Some great plugins for the framework can be found here.

    Over the next week or so I’m going to remake this entire blog with BluePrint and updating this post with progress and thoughts on about the CCS framework. Stay Tuned…

    Update

    06/2/09

    Today I have been playing around for a couple hours with the framework, so far so good… its been easy to align copy and set widths. Only issues have come across so far are using <ul/> for navigation and have divs floated to the right.  Still TBD if the framework supports this type of functionality or not.

    06/3/09

    After playing around with framework for a couple hours I was able to get a decent understanding of things. Like many CSS designers I have had a self made framework that I used to approach projects. However BluePrint is definitely a nice tool to be using. After 3-4 hours of playing around I became comfortable using it… the only thing that is a little hard to predict is how it will act with my own styles that I’ve been adding.

    More updates to come…

    blueprint1

    You can view progress of the updated design in real time by clicking here.



Older Posts »