Bringing It Together With Semantics

Kevin Lawver

This is a presentation. If you'd like to view all the slides like a normal web page, you can.

So Now You Know HTML and CSS

Bringing The Two Together

Kevin's Theory of Heterogeneous Markup

Homogenous Example

Taken from AOL Search 6.0:


<div id="results">
<div class="result" onmouseover="linkHover(this)" onmouseout="linkHide()">
  <div class="link">
    <div class="linkdetail" >
      <a id="lrurl1" href="http://toefl.org"><span id="ltitle1"><b>Test</b> of English as a Foreign Language (TOEFL)</span></a><br />
      <span id="ldesc1">Information about the TOEFL tests and services are available online. Try the  TOEFL practice questions.</span><br />
      <b><span id="ldurl1">http://www.ets.org/toefl/</span></b>
    </div>
  </div>
</div>
</div>

Heterogeneous Version

Taken from Site & Channel Search for the same result:

<ul class="results">
<li id="google_strict_teensItem1"><a href="http://toefl.org">Test of English as a Foreign Language (TOEFL)</a>
 - Information about the TOEFL tests and services are available online. Try the TOEFL practice questions.
<cite>http://www.ets.org/toefl/</cite>
</li>
</ul>

The Difference

Thinking Outside The Box (div)

Remove Span From Your Vocabulary

Semantics Are What You Make of Them

Building Semantic CSS

My Homogenous Selector

To style example one's URL:

Oh wait, I can't, because it uses b's in the title and description.

Homogenous Take Two

If I really had to...

#ldurl1 { 
    font-weight:normal; 
    font-variant: normal;
    color:#999;
}

Anyone see a problem with that?

My Heterogeneous Selector

To style example two's URL:

ul.results li cite {
    font-weight:normal; 
    font-variant: normal;
    color:#999;
}

Semantic CSS...

Burn The Blankets

Give Every Selector A Home

Create Scopes And Stick To Them

Appropriately Specific

Keep Your CSS Orderly

Keep Your Declarations Orderly

Sandbox "Dangerous" Content

Best Practices For The Syndicator

Best Practices For The Includer

Example: Document Skeleton

Example: Imported Content

Example: Imported Content Run Amok

Example: In The Real World... Imported Content

Conclusions

Challenges

Questions?

category: Presentations, CSS, Markup