View Single Post
Old 01-05-2013, 12:35 AM   PM User | #33
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Okay, Andrew.

Why doesn't this work?
Code:
<!DOCTYPE html>
<html lang="en-GB">
<head>
    <meta charset="utf-8">
    <meta name="keywords" content="key, words">
    <meta name="description" content="description">
    <title>Check It</title>
    <style type="text/css">
    label {
        display: block;
        margin-top: 2px; margin-bottom: 2px;
    }

    label.checking input[type=checkbox] {
        display: inline;
        width: 1.2em;
        vertical-align: middle;
        outline: none;
        opacity: 0;
        width: 18px; height: 18px;
        margin: 0 0 0 8px; padding: 0;
        z-index: 10;
    }
    span.checking {
        margin: 0;
        padding: 0 0 0 18px;
        position: relative; left: -18px;
        z-index: 25;
        height: 18px;
        background: url('images/checkblank.png') right center no-repeat;
    }
    label.checking input[type=checkbox]:checked + span.checking {
        background: url('images/checktick.png') right center no-repeat;
    }
    span.red { 
        color: red; 
    }
    label.checking input[type=checkbox]:checked + span.red {
        color: green;     
    }
    </style>
</head>
<body>
<label class="checking"><input type="checkbox" id="remember" 
        name="remember" value="yes"><span class="checking"></span
        ><span class="red">Remember me</span
        ></label>
</body>
</html>
Why will it change the background of <span class="checking"> but not the color of <span class="red"> ???
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote