The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> CSS doesn't work with DOCTYPE, css DOCTYPE
kkxx1254
post Oct 7 2009, 12:42 PM
Post #1





Group: Members
Posts: 2
Joined: 7-October 09
Member No.: 9,956



hi,
I want to make a "div" that width is 200px and height is 100px as following:
==============
<!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>
<title>hello</title>
</head>
<body>
<div style="width:200;heigth:100;background:silver;">
hello everyone!
</div>
</body>
</html>
==============
however,it displays as:width is 100% and height is as height as a word . But if I delete the DOCTYPE,it works as i expected above.
so,how can i achieve the effect if i don't delete the DOCTYPE?
thanks.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 7 2009, 03:20 PM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,478
Joined: 9-August 06
Member No.: 6



By doing it right. Browsers are a little more lenient when in Quirks Mode. Almost all CSS properties that take a numeric value require a unit when the value is other than zero. wink.gif
http://www.w3.org/TR/CSS2/syndata.html#value-def-length

About Quirks and Standards Mode...
http://hsivonen.iki.fi/doctype/


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
kkxx1254
post Oct 8 2009, 12:06 AM
Post #3





Group: Members
Posts: 2
Joined: 7-October 09
Member No.: 9,956



QUOTE(pandy @ Oct 8 2009, 04:20 AM) *

By doing it right. Browsers are a little more lenient when in Quirks Mode. Almost all CSS properties that take a numeric value require a unit when the value is other than zero. wink.gif
http://www.w3.org/TR/CSS2/syndata.html#value-def-length

About Quirks and Standards Mode...
http://hsivonen.iki.fi/doctype/


rolleyes.gif thanks a lot!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 8 2009, 04:53 AM
Post #4


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,478
Joined: 9-August 06
Member No.: 6



You are welcome. smile.gif


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
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: 1st October 2014 - 11:22 PM