The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Doctype removing div styling
adamkelly
post Jun 6 2010, 06:21 AM
Post #1





Group: Members
Posts: 8
Joined: 16-June 09
Member No.: 8,894



Hey guys,

If I add a doctype, be it transitional or strict, to an HTML page I have it removes the styling of some DIVs.

The HTML & css is:

CODE

<span class="colour-picker">
    <div class="tick-off" id="Black" title="Black" onclick='$(".pricelist").hide();
                          $(".tick-on").removeClass("tick-on").addClass("tick-off");
                          $("#PC_Black").show();
                          $("#ctl00_imgMain").attr("src","../productimages/280/CAN_SX210IS_Black.jpg"/*tpa=http://www.cameraclick.co.uk/productimages/280/CAN_SX210IS_Black.jpg*/);
                          this.className="tick-on";
                          return(false)'>
    </div>
    <div class="tick-off" id="Purple" title="Purple" onclick='$(".pricelist").hide();
                          $(".tick-on").removeClass("tick-on").addClass("tick-off");
                          $("#PC_Purple").show();
                          $("#ctl00_imgMain").attr("src","../productimages/280/CAN_SX210IS_Purple.jpg"/*tpa=http://www.cameraclick.co.uk/productimages/280/CAN_SX210IS_Purple.jpg*/);
                          this.className="tick-on";
                          return(false)'>
    </div>
    <div class="tick-off" id="Gold" title="Gold" onclick='$(".pricelist").hide();
                          $(".tick-on").removeClass("tick-on").addClass("tick-off");
                          $("#PC_Gold").show();
                          $("#ctl00_imgMain").attr("src","../productimages/280/CAN_SX210IS_Gold.jpg"/*tpa=http://www.cameraclick.co.uk/productimages/280/CAN_SX210IS_Gold.jpg*/);
                          this.className="tick-on";
                          return(false)'>
    </div>
    <div style="float: right; margin-right: 6px;">
        Choose&nbsp;colour:</div>
</span>


CODE

.colour-picker #purple {
    background-color: purple;
    width: 20px;
    height: 19px;
    display: block;
    margin: 6px 2px 8px 2px;
    float: right;
}

.colour-picker #gold {
    background-color: #DAA520;
    width: 20px;
    height: 19px;
    display: block;
    margin: 6px 2px 8px 2px;
    float: right;
}

.colour-picker #black {
    background-color: black;
    width: 20px;
    height: 19px;
    display: block;
    margin: 6px 2px 8px 2px;
    float: right;
}


When a doctype is added it completely ignores '.colour-picker #black' etc but when it's removed it shows it again??

Any ideas from that?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
adamkelly
post Jun 6 2010, 06:27 AM
Post #2





Group: Members
Posts: 8
Joined: 16-June 09
Member No.: 8,894



forgot to add:

without doctype:

http://grab.by/4Map

with doctype:

http://grab.by/4Mas
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 6 2010, 06:51 AM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,732
Joined: 9-August 06
Member No.: 6



The id names use different case in the CSS and the HTML.

http://www.w3.org/TR/CSS2/syndata.html#characters
http://www.w3.org/TR/html401/struct/global.html#adef-id
[CS] means Case Sensitive.

Here's why the doctype makes a difference.
http://hsivonen.iki.fi/doctype/

Nothing to do with your problem, but SPAN can't contain block level elements.
http://www.htmlhelp.com/cgi-bin/validate.c...2Fhtml%3E%0D%0A
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 08:54 PM