Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 637235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:36:07+00:00 2026-05-13T20:36:07+00:00

I am trying to do the tutorial in Chapter 6 of the 2nd edition

  • 0

I am trying to do the tutorial in Chapter 6 of the 2nd edition of “CSS: The Missing Manual”, and I’ve run into an issue I’m trying to understand.

I have one style that looks like this:

#main p:first-line {
    color: #999999;
    font-weight: bold;
}

Later I have another style that looks like this:

#main p.byline {
    color: #00994D !important;
    font-size: 1.6em;
    margin: 5px 0 25px 50px;
}

I am confused because the second one won’t override the color choice in the first one despite the fact that the second one has “!important” in it. I put both classes into an online specificity calculator, and the second one comes out being more specific, so I’m doubly confused.

By the way, the inclusion of “!important” is the work-around suggested in the errata for the book. Odd that it still doesn’t work!

Here’s the code for the entire page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CSS Typography</title>
<style type="text/css">
    html, body, h1, h2, h3, h4, h5, h6, p, ol, ul, li, pre, code, address, variable, form, fieldset, blockquote {
    padding: 0;
     margin: 0;
     font-size: 100%;
     font-weight: normal;
    }
    table { border-collapse: collapse; border-spacing: 0; }
    td, th, caption { font-weight: normal; text-align: left; }
    img, fieldset { border: 0; }
    ol { padding-left: 1.4em; list-style: decimal; }
    ul { padding-left: 1.4em; list-style:square; }
    q:before, q:after { content:''; }

body {
    color: #002D4B;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 62.5%
}

#main h1 {
    color: #F60;
    font-family: "Arial Black", Arial, Helvetica, sans-serif;
    font-size: 4em;
}
#main h2 {
    font: bold 3.5em "Hoefler Text", Garamond, Times, serif;
    border-bottom: 1px solid #002D4B;
    margin-top: 25px;
}
#main h3 {
    color: #F60;
    font-size: 1.9em;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 25px;
    margin-bottom: 10px;
}
#main p {
    font-size: 1.5em;
    line-height: 150%;
    margin-left: 150px;
    margin-right: 50px;
    margin-bottom: 10px;
}
#main p:first-line {
    color: #999999;
    font-weight: bold;
}
#main ul {
    margin: 50px 0 25px 50px;
    width: 150px;
    float: right;
}
#main li {
    color: #207EBF;
    font-size: 1.5em;
    margin-bottom: 7px;
}
#main p.byline {
    color: #00994D !important;
    font-size: 1.6em;
    margin: 5px 0 25px 50px;
}

#main .byline strong { color: #207EBF; text-transform: uppercase; margin-left: 5px;
}

</style>
</head>

<body>
<div id="main">
<h1><strong>CSS</strong> The Missing Manual</h1>
<h2>Exploring Typographic Possibilities</h2>
<p class="byline">november 30 <strong>Rod Dibble</strong></p>
<ul>
  <li>Lorem Ipsum</li>
  <li>Reprehenderit qui in ea</li>
  <li>Lorem Ipsum</li>
  <li>Reprehenderit qui in ea</li>
  <li>Lorem Ipsum</li>
  <li>Reprehenderit qui in ea</li>
</ul>
<h3>Esse quam nulla</h3>
<p>Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
<h3>Quis autem vel eum</h3>
<p>Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
</div>
</body>
</html>

Here is the above code on JSBin: http://jsbin.com/unexe3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:36:07+00:00Added an answer on May 13, 2026 at 8:36 pm

    The !important property is being applied to .byline, but you don’t have enough content in the paragraph to realize it (it isn’t being applied to the first line). The #main p:first-line selector is more specific to the first line of the element than #main p.byline. You can fix it pretty easily by changing the first-line selector to only apply to paragraph elements that follow h3 elements.

    #main h3+p:first-line
    {
        color: #999999;
        font-weight: bold;
    }
    

    Also, the specificity calculator was probably not completely accurate because :first-line isn’t a real element, but a pseudo-element. Smashing Magazine has a nice article on Advanced CSS Selectors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm on Chapter 4: Templates of the Django tutorial, and I'm trying to run
I'm trying to follow the Sequelize tutorial on their website . I have reached
I'm trying to follow THE magnificient Rails3 tutorial at http://railstutorial.org but ran into a
I'm trying to run the chapter two demo_app from the Ruby on Rails 3
I'm trying to learn RoR following this tutorial and I'm currently in chapter 3.
I have been reading through this tutorial . I am in a chapter where
I am trying this simple tutorial from oracle : http://www.oracle.com/technetwork/java/socket-140484.html (the Example 1 ).
Im trying to follow a tutorial that is using SBJsonParser to get twitter feeds,
Trying to add a blank sample app for a rails tutorial to GitHub, but
Trying to learn a bit about PDO and is going through this tutorial .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.