0

I'm very new to HTML and CSS. This is an example directly taken from Jon Duckett's book.

<!DOCTYPE html>
<html>
    <head>
        <style type="text/css">

        body {
            font-family: Arial, Verdana, sans-serif;
            color: #111111;}
        table {
            width: 600px;}
        th, td {
            padding: 7px 10px 10px 10px;}
        th {
            text-transform: uppercase;
            letter-spacing: 0.1em;
            font-size: 90%;
            border-bottom: 2px solid #111111;
            border-top: 1px solid #999;
            text-align: left;}
        tr.even {
            background-color: #efefef;}
        tr.hover {
            background-color: #c3e6e5;}
        .money {
            text-align: right;}     

        </style>

    </head>
    <body>
        <h1>First Edition Auctions</h1>
        <table>
            <tr>
                <th>Author</th>
                <th>Title</th>
                <th class="money">Reserve Price</th>
                <th class="money">Current Bid</th>
            </tr>

            <tr>
                <td>E.E. Cummings</td>
                <td>Tulips & Chimneys</td>
                <td class="money">$2,000.00</td>
                <td class="money">$2,642.50</td>
            </tr>

            <tr class="even">
                <td>Charles d'Orleans</td>
                <td>Poemes</td>
                <td class="money"></td>
                <td class="money">$5,866.00</td>
            </tr>
            <tr>
                <td>T.S. Eliot</td>
                <td>Poems 1909 - 1925</td>
                <td class="money">$1,250.00</td>
                <td class="money">$8,499.35</td>
            </tr>

            <tr class="even">
                <td>Sylvia Plath</td>
                <td>The Colossus</td>
                <td class="money"></td>
                <td class="money">$1,031.72</td>
            </tr>
        </table>
    </body>
</html>

You can view the output here, with the hover there also not working.

It looks like the example on his website works fine. I'm not sure what I did wrong in my code. It looks fine.

Browser I'm using is Chrome 48.0.2564.97.

1
  • 1
    did you mean tr:hover? Commented Feb 3, 2016 at 15:43

4 Answers 4

5

:hover is a pseudo-class.

It is preceded by a colon (:) not a period (.)

Sign up to request clarification or add additional context in comments.

Comments

1

Use :hover instead of .hover (.hover matches tag with class="hover")

tr:hover {
    background-color: #c3e6e5;}

Comments

0

Your issue is you called out a class instead of declaring a state.

tr.hover {background-color: #c3e6e5;}

Should be

tr:hover {background-color: #c3e6e5;}

The period in your original version calls out a class that doesn't exist.

Comments

0

It should read

tr:hover {background-color: #c3e6e5;}

not

tr.hover {background-color: #c3e6e5;}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.