+ -
当前位置:首页 → 问答吧 → 为什么这样写

为什么这样写

时间:2011-09-16

来源:互联网

class="passport-main code-num" 我看别人的网页是发现他是这样写的而且 在css文件当中是这样写样式的 
.passport-main {
  height: 29px;
  margin: 0 auto;
  width: 960px;
}
(第 219 行)
.code-num {
  font-family: "Arial","宋体";
}
(第 182 行)
div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, blockquote, p {
  margin: 0;
  padding: 0;
}
class中间空格 就可以调用样式了为什么啊?首先说声谢谢啊。

作者: wupenpen   发布时间: 2011-09-16

html标签的中的class属性中间存在空格,表示是此标签引用两个class 

如何:

<!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" />
<title>html标签的中的class属性中间存在空格</title>
<style type="text/css">
<!--
  .mygod{
  color:red;
  }
  .mygod2{
  font-size:100px;
  }

-->
</style>
</head>
<body>
<div class="mygod mygod2">今天老板不在,明天停电今天老板不在,明天停电今天老板不在,明天停电</div>
</body>
</html>

作者: npfang   发布时间: 2011-09-16

包含关系

作者: PHPNewMan   发布时间: 2011-09-16

引用 1 楼 npfang 的回复:

html标签的中的class属性中间存在空格,表示是此标签引用两个class

如何:

<!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……

正解,随便你写多少个样式都可以中间空格隔开就行

作者: veval   发布时间: 2011-09-16

引用两个CLASS

作者: bingo888888   发布时间: 2011-09-16

热门下载

更多