Main Points

History is Now


OO - CSS is highly versatile. When I first began experimenting in OO - CSS, it will come as no surprise that I was creating a new website design. Specifically, I was making over Earth Chronicle with the new Medieval Scroll design. So while there are many components which can be used in production websites, these are some of my favorite components for managing the design workflow as you create a website or a web application. If any of these components meet your specs, they're fully tested out for use in a production website. On the other hand, these are primarily geared towards making life easier for web designers as they develop their XHTML prototypes.

Note: Like the main OO - CSS gallery, this is not designed as a teaching tool, but a quick and easy way to see what the OO - CSS components look like. The CSS style rules are supplied so you can drop them into your stylesheets, and then write XHTML based on the examples to trigger those effects.

Structural Components

Selections and Tests

Sometimes you want to be able to mark items in your documentation, especially when you've provided a client with a list of options and they've selected one or two. In those cases, I like to document the selection so that everyone is on the same page. This is one reason I like XHTML prototyping; it makes documentation so easy and it's all centrally located (on the test site) so that there's no question what the current version or state of the design is. If it's up on the test site, it's current.

Alternatively, there are times you want to demonstrate some kind of functionality. This could be custom web design, OO - CSS, but it can also be client or server side application output. This gallery in fact, uses exactly this technique, the testOutput class, to indicate the demo vs. the descriptions and the code.

This certainly is not a terribly complicated component, it's simply a wrapper div styled with a thick red border. But as you can see throughout this page, it's critical for clearly marking what is and is not part of tests and demos, and I use it all the time.

Component CSS

.selected,
.testOutput {
border: 0.2em solid #FF0000;
}

Component XHTML

<div class="testOutput">
This content is part of a test.
</div>

This is content which is introducing a test.

This content is part of a test.

This is content which is discussing the previous test.

Web Design Tools

XHTML prototyping allows us to build the website live and see how it behaves. It also completes large amounts of documentation tasks simultaneously with building the design tests. Further, it virtually requires testing throughout the design process which ensures a robust design, as opposed to locking yourself into an image comp, and then starting to think if the webpage code which results is a good idea (or even possible). Additionally, prototyping and documenting the design in XHTML enables us to bring OO - CSS to bear on the design process, and a well-built style sheet optimized for maintenance allows for much more efficient changes throughout the design process than trying to modify an image comp.

Color List

Color list is a component for providing a live demonstration of colors (or potential colors) for a palette. I typically use it early in the color selection process to identify and test colors cross-monitor. While designers have a general sense of what colors will look good, I hate generalities and maybes in my designs. Color list forces you to deal with the realities of your web design as it will look in the wild (as opposed to a Pantone color chip). This makes color selection much more concrete and real world.

Component CSS

/* Color List */

.colorList {
background-color: #CCCCCC;
border: 0.5em solid black;
padding: 1em 2em;
}

.colorList li {
margin: 1em 0;
padding-left: 0.3em;
border-left: 1.6em solid;
}

Component XHTML

<ul class="colorList">
<li style="border-color: #C38E63">
<strong>Tan (#C38E63)</strong> - Rustic and woodsy
</li>
<li style="border-color: #ED8200">
<strong>Amber (#ED8200)</strong> - Mellow, it's an Autumn leaf color
</li>
<li style="border-color: #FFDFAC">
<strong>Ayer Beige (#FFDFAC)</strong> - Soft and earthy; a historical document sample
</li>
.
.
.
</ul>
  • Tan (#C38E63) - Rustic and woodsy
  • Amber (#ED8200) - Mellow, it's an Autumn leaf color
  • Ayer Beige (#FFDFAC) - Soft and earthy; a historical document sample
  • Taupe (#A9A28D) - Classic and organic
  • Ivory (#F2E4C3) - Classic and warm, a natural color
  • Chocolate Brown (#5E1302) - Rich and delicious
  • Brick Red (#A6201D) - Earthy and strong
  • Bright Blue (#0077D4) - Vibrant and aquatic, a sea color
  • Deep Blue (#00237E) - Authoritative, a different mood but also a sea color
  • Bright Green (#009543) - Fresh, it's a Spring color
  • Foliage Greens (#006233) - Lush and natural

Note: I usually avoid inline styling like the plague. However, in keeping with OO - CSS, it's important to code to your abstractions, and this is where the border color definitions belong. The hex code is not only part of the color, but it controls the shade of the color which is the topic of discussion, in short it's content so it should be expressed inline. Therefore, I've broken my typical preferences, because it's more important to maintain the abstraction.

There's another reason as well, maintainability. My first design used classes in a linked stylesheet to define the border color for each list item. That worked OK when I had a limited number of colors (about a dozen) for the one design. However, as an OO - CSS component that technique would require more than 16.7 million classes to cover all colors. Assuming you had the patience, you'd destroy your bandwidth downloading a stylesheet of that size. Moreover, it would be very difficult to remember exactly which class names invoked which colors. Also, it would be a nightmare switching back and forth between the visible text of the hex code written on the page and the linked stylesheet where the hex codes are used in the style rules. It's so much easier to make changes when they're in the same place, just one line apart in code.

Design Background

When working in my image editing software, I like to have a nice grey background for judging colors. This is the same idea behind the neutral grey background in color list. The exact same principle holds for reviewing images in your image editor and in your XHTML documentation. Image editors make it easy to view images against a neutral background, and design background is a component which answers this need in XHTML. It's also nicely flexible – you can use it two ways. If you have a single image, apply the designBg class to the image itself, or if you have many images, wrap them all in a div element with the class, and each image in the div will be matted against the neutral background.

Component CSS

/* Design Background */
.designBg img,
img.designBg {
margin: 1em;
padding: 2em;
background-color: #CCCCCC;
border: 0.5em solid #000000;
}

Component XHTML

<div class="designBg">
<p>
Here's version five of the proposed contact us image.
</p>

<img src="../Images/ContactUsBox5.jpg" height="150" width="150" alt="A demo of the proposed contact us image." />

<p>
Here's version five of the proposed rollover state of the contact us image.
</p>

<img src="../Images/ContactUsBoxHighlight5.jpg" height="150" width="150" alt="A demo of the proposed rollover state of the contact us image." />
</div>

Here's version five of the proposed contact us image.

A demo of the proposed contact us image.

Here's version five of the proposed rollover state of the contact us image.

A demo of the proposed rollover state of the contact us image.

Software Architecture Charts

Architecture Charts are primarily aimed at providing an XHTML component for visualizing project architecture. Further, using links, you can dive into more detail on another webpage and get down into detailed design, possibly using more architecture charts. Or you can break out vertical slices of the design, as in this example. My color scheme is orange for UI classes, blue for application logic classes, green for DAL classes, and purple for file system diagrams.

Component CSS

.softwareArchitectureChart, .architectureLayer, .architectureLayer div {
position: relative;
margin: 1em 1em 0 0;
padding: 0.5em;
}

.architectureLayer {
clear: both;
}

.architectureLayer div {
min-width: 8em;
margin-bottom: 0.5em;
z-index: 10;
}

.softwareArchitectureChart {
background-color: #FFFFFF;
}

.appLogicChart .architectureLayer {
background-color: #0000FF;
}

.appLogicChart .architectureLayer div {
background-color: #00FFFF;
}

.dalChart .architectureLayer {
background-color: #00AA00;
}

.dalChart .architectureLayer div {
background-color: #00FF00;
}

#fileSystemChart .architectureLayer,
.fileSystemChart .architectureLayer {
background-color: #990099;
}

#fileSystemChart .architectureLayer div,
.fileSystemChart .architectureLayer div {
background-color: #FFFF00;
}

.uiChart .architectureLayer {
background-color: #FF6600;
}

.uiChart .architectureLayer div {
background-color: #FFAA00;
}

Component XHTML

<div class="softwareArchitectureChart dalChart">
<h3>
DAL: Data Access Layer
</h3>
<div class="architectureLayer">
<h4>
Database SQL Command (Examples)
</h4>
<div>
Link Factory Data (Primary DB)
</div>
<div>
Character Set Data (MySQL-Info DB)
</div>
<div>
Test Data (Testing DB)
</div>
</div>
.
.
.
<div class="spacer"></div>
</div>

DAL: Data Access Layer

Database SQL Command (Examples)

Link Factory Data (Primary DB)
Character Set Data (MySQL-Info DB)
Test Data (Testing DB)

Database-Specific Commands

Primary DB Command (MySQL)
MySQL-Info DB Command (MySQL)
Testing DB Command (MS SQL)

Generalized Database Helper Classes

Access DB Command
MS SQL DB Command
MySQL DB Command

You can see how this is a great way to map out high level design visually in XHTML. Alternatively, this component can be used for much more complicated and detailed levels of application design. Here's an example of what the charts can do in a detailed discussion of a deep vertical slice of an application.

Component XHTML

<div class="softwareArchitectureChart">
<h3>
DAL: Data Access Layer
</h3>
<div class="uiChart">
<div class="architectureLayer">
<h4>
Top Level UI Class (Master Page)
</h4>
<div>
<code>protected void processLoginRequest(object sender, EventArgs e)</code>
Authenticates the user and creates a new session.<br />
<code class="computerCode">
isUserAuthenticated = blockAuthenticationManager.authenticateUser(inputValidatedUsername, inputValidatedPassword);<br />
<br />
blockCustomSessionId = blockSessionManager.getSessionId(inputValidatedUsername, inputValidatedPassword);<br />
Session["CustomSessionId"] = blockCustomSessionId;<br />
</code>
</div>
</div>
</div>
<div class="appLogicChart">
<div class="architectureLayer">
<h4>
Authentication Manager
</h4>
<div>
Authentication Manager code...
</div>
</div>
<div class="architectureLayer">
<h4>
Session Manager
</h4>
<div>
Session Manager code...
</div>
</div>
</div>
<div class="dalChart">
<div class="architectureLayer">
<h4>
Data Access Layer
</h4>
<div>
DAL code...
</div>
<div>
And yet more DAL code...
</div>
</div>
</div>
</div>

Login and Session Management

Top Level UI Class (Master Page)

protected void processLoginRequest(object sender, EventArgs e) Authenticates the user and creates a new session.
isUserAuthenticated = blockAuthenticationManager.authenticateUser(inputValidatedUsername, inputValidatedPassword);

inputCustomSessionId = blockSessionManager.getSessionId(inputValidatedUsername, inputValidatedPassword);
blockCustomSessionId = inputCustomSessionId.getValidatedInput();
Session["CustomSessionId"] = blockCustomSessionId;

Authentication Manager

public bool authenticateUser(ValidatedUsername inputValidatedUsername, ValidatedPassword inputValidatedPassword) Takes the username and retrieves the database record. Takes the password, hashes it, and compares it against the hash stored in the database.
inputHashedPassword = blockEncryptionManager.encypherPassword(inputValidatedPassword);
blockPasswordHashFromDatabase = getPasswordHashFromDatabase(inputValidatedUsername);

Session Manager

public ValidatedSessionData getSessionId(ValidatedUsername inputValidatedUsername, ValidatedPassword inputValidatedPassword) Takes the username, generates a session id, and stores it in the user's database record.
workingValidatedSessionId = new SessionValidatedHexNumbers(sessionIdGenerator.getRandomHexadecimalString(64));
userRecordData.updateCreateNewUserSession(workingValidatedSessionId, inputValidatedUsername);

Data Access Layer

public DataTable getPasswordHashDataTable(ValidatedUsername inputValidatedUsername) Takes the username and retrieves the hashed password stored in the user's database record.
ourUserRecordData.updateCloseSession(inputCustomSessionId);
Session["CustomSessionId"] = "";
public void updateCreateNewUserSession(ValidatedSessionData inputValidatedSessionId, ValidatedUsername inputValidatedUsername) Takes the username and stores the new session id in the user's database record.
inputSqlUpdateText += "UPDATE users " + sqlNewLine;
inputSqlUpdateText += "SET users.`SessionId` = @SessionId, " + sqlNewLine;
inputSqlUpdateText += sqlTab + "users.`SessionExpires` = @SessionExpires" + sqlNewLine;
inputSqlUpdateText += "WHERE users.`Name` = @Name " + sqlNewLine;
inputSqlUpdateText += ";";

OO - CSS gives us the ability to implement new structures almost instantly because we can reuse the components "as is" from other websites. But the advantages don't stop there; with these components we can increase the efficiency of the design process itself. During web design, OO - CSS allows us to leverage standardized components, support efficient design practices, and provide XHTML documentation of the complete design process for any stakeholders who should be involved. I can't imagine trying to create a new website without them.

I also have galleries of OO - CSS components for production use, and another for key CSS techniqes implemented traditionally without OO - CSS.