為什么什么都沒(méi)有顯示
!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" />
<style>
? ? .myBox{
? ? ? ? width:200px;
? ? ? ? height:100px;
? ? ? ? border:1px solid red;
? ? ? ? margin-top:10px;
? ? ? ? padding-left:15px;
? ? }
</style>
<div class="myBox">Hello World!</div>
</head>
<body>
<div class="myBox1">Hello world</div>
</body>
</html>
哪里錯(cuò)了?
2016-10-20
我這里顯示你創(chuàng)建了兩個(gè)DIV標(biāo)簽,分別是myBox和myBox1;
其中,第一個(gè)DIV是在head標(biāo)簽里,第二個(gè)是在body標(biāo)簽里,所以第一個(gè)無(wú)法顯示的,第二個(gè)人可以顯示。
CSS部分是針對(duì)第一個(gè)div的,所以也顯示不出效果。
不懂為什么會(huì)把div寫到head里?。?/p>
那里不可以寫div的。
2016-10-20
2016-10-19
就是你的style 定義class的時(shí)候, 文件是css。 所以你得寫 <style type="text/css>
2016-10-19
不懂?
2016-10-19
style 部分代碼是
<style type="text/css">開(kāi)始, 表示文件是css