Home arrow Style Sheets arrow Page 4 - Template Presets for the Yahoo Grid CSS
STYLE SHEETS

Template Presets for the Yahoo Grid CSS


If you're looking for a fast way to set up a professional-looking web site, this series of articles may be just what you need. It shows you how to use Yahoo Grid CSS, a CSS library that will help you build web pages quickly.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 5
August 22, 2007
TABLE OF CONTENTS:
  1. · Template Presets for the Yahoo Grid CSS
  2. · Using customized web page templates with the Yahoo Grid CSS framework
  3. · Building web pages with custom widths
  4. · Introducing the concept of web page presets

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

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.

blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials