Style Sheets
  Home arrow Style Sheets arrow Page 4 - Template Presets for the Yahoo Grid CSS
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Template Presets for the Yahoo Grid CSS
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2007-08-22

    Table of Contents:
  • Template Presets for the Yahoo Grid CSS
  • Using customized web page templates with the Yahoo Grid CSS framework
  • Building web pages with custom widths
  • Introducing the concept of web page presets

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Template Presets for the Yahoo Grid CSS - Introducing the concept of web page presets


    (Page 4 of 4 )

    In this section, I'm going to show you how to implement what in the context of Yahoo Grid CSS is called a "web page preset." In simple terms, the library incorporates seven predefined web page layouts, identified as "yui-t1", "yui-t2", … "yui-t7".

    As you'll see, these presets allow to create common web page layouts in a snap, without having to code your own DIVs. In order to do this, you use two main blocks, called "primary" and "secondary" respectively. Yahoo assumes that the secondary block is by default placed on the left of the web document, while the primary one is located on its right.

    But, I think that you understand all these concepts better if you look at the following code sample. It builds a simple web page by using the first Yahoo preset, named "yui-t1":

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>YUI Grid CSS - Template t1 (secondary block is placed
    160px on left)</title>
    <!-- Source File -->
    <link rel="stylesheet" type="text/css"href="yui/build/grids/grids-min.css" />
    </head>
    <body>
    <div id="doc"class="yui-t1">
    <div id="hd">
    <!-- header -->
    <h2>This is the header section</h2>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Maecenas sit amet metus. Nunc quam elit, posuere nec, auctor in,
    rhoncus quis, dui. Aliquam erat volutpat. Ut dignissim, massa sit
    amet dignissim cursus, quam lacus feugiat dolor, id aliquam leo
    tortor eget odio. Pellentesque orci arcu, eleifend at, iaculis
    sit amet, posuere eu, lorem. Aliquam erat volutpat. Phasellus
    vulputate. Vivamus id erat. Nulla facilisi. Class aptent taciti
    sociosqu ad litora torquent per conubia nostra, per inceptos
    hymenaeos. Nunc gravida. Ut euismod, tortor eget convallis
    ullamcorper, arcu odio egestas pede, ut ornare urna elit vitae
    mauris. Aenean ullamcorper eros a lacus. Curabitur egestas tempus
    lectus. Donec et lectus et purus dapibus feugiat. Sed sit amet
    diam. Etiam ipsum leo, facilisis ac, rutrum nec, dignissim quis,
    tellus. Sed eleifend.</p>
    </div>
    <div id="bd">
    <!-- body -->
    <div id="yui-main">
    <div class="yui-b">
    <p>Main Block</p>
    </div>
    </div>
    <div class="yui-b">
    <p>Secondary Block</p>
    </div>
    </div>
    <div id="ft">
    <!-- footer -->
    <h2>This is the footer section</h2>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Maecenas sit amet metus. Nunc quam elit, posuere nec, auctor in,
    rhoncus quis, dui. Aliquam erat volutpat. Ut dignissim, massa sit
    amet dignissim cursus, quam lacus feugiat dolor, id aliquam leo
    tortor eget odio. Pellentesque orci arcu, eleifend at, iaculis
    sit amet, posuere eu, lorem. Aliquam erat volutpat. Phasellus
    vulputate. Vivamus id erat. Nulla facilisi. Class aptent taciti
    sociosqu ad litora torquent per conubia nostra, per inceptos
    hymenaeos. Nunc gravida. Ut euismod, tortor eget convallis
    ullamcorper, arcu odio egestas pede, ut ornare urna elit vitae
    mauris. Aenean ullamcorper eros a lacus. Curabitur egestas tempus
    lectus. Donec et lectus et purus dapibus feugiat. Sed sit amet
    diam. Etiam ipsum leo, facilisis ac, rutrum nec, dignissim quis,
    tellus. Sed eleifend.</p>
    </div>
    </div>
    </body>
    </html>

    Hopefully, the above code sample will be rather easy to grasp. As you can see, I assigned a "yui-t1" class to the main wrapped DIV of the pertinent web page. I then created two additional block DIVs, identified as "yui-b," where the first one was wrapped by another, called "yui-main." In this way I built the primary and secondary blocks that I mentioned before.

    All of these conventions used within the Yahoo Grid CSS framework may sound rather confusing in the beginning, but as you get used to them, they'll become more intuitive and familiar.

    Below I included a screen shot which shows the final web page created by the previous (X)HTML file. Have a look at it, please:

    As you can see, the secondary block is placed 160px on the left, according to the specifications of the "yui-t1" preset, followed by the corresponding primary section. Things are much simpler to grasp now, right?

    The previous example only demonstrates how to use the first preset included with the Yahoo Grid CSS framework. There are still six more to be reviewed. These will be covered in the next part of this series. Until then, feel free to experiment with all the code samples that I provided here, so you can acquire some practice in using this helpful CSS library.

    Final thoughts

    In this second installment of the series, you hopefully learned how to build custom web pages with the Yahoo Grid CSS, and how to use the first preset packaged with this library. Nonetheless, as I stated earlier, there are some topics that deserve a detailed analysis, such as the utilization of nested grids, which can be useful for creating complex web page layouts. All of these interesting things will be discussed in the next part.

    Now that you've been warned, you won't want to miss it!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This second part of the series goes through the utilization of the different web...
     

    STYLE SHEETS ARTICLES

    - Image Replacement CSS Techniques
    - Using BlueTrip`s Success, Notice and Error C...
    - More Uses for the Thin and Caps CSS Classes ...
    - Styling Definition Lists with the BlueTrip C...
    - Styling Unordered and Ordered HTML Lists wit...
    - Using the BlueTrip CSS Framework`s Thin and ...
    - Adding Borders to Web Page Columns with Blue...
    - Introducing the BlueTrip CSS Framework
    - Using a Background Grid to Assist Web Page L...
    - Extending the Rule Of Thirds for Web Page La...
    - A Two-Column Web Page Layout Based on the Ru...
    - Using the Rule Of Thirds for Web Page Layout
    - Swapping Columns Using the Divine Ratio for ...
    - Using the Golden Ratio in Liquid Web Page De...
    - Fundamental Design Principles for Web Page L...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek