《CSS入门经典》中的一个问题

usa112233 2010-01-26 04:44:11
367页第11章例18,固定页眉,例中width减了21,height减了35,可我楞是没看出来这21和35是怎么算出来的,请各位高手指点一下。
...全文
145 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
usa112233 2010-02-01
  • 打赏
  • 举报
回复
有E文电子版的
xeker 2010-01-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 cs5276 的回复:]
。。。。楼主,给我们买本那个书吧,买完给你看看,呵呵
[/Quote]
正解
lermother 2010-01-28
  • 打赏
  • 举报
回复
ding
街头小贩 2010-01-28
  • 打赏
  • 举报
回复

width:expression(documentElement.offsetWidth-21);
height:expression(documentElement.offsetHeight-35);

这个?只有微软IE支持.其它标准解析器会忽略它
usa112233 2010-01-28
  • 打赏
  • 举报
回复
大致的内容如下,问题就是那个需要减的21和35是怎么计算出来的,
body{
background:lightyellow;
font:12px sans-serif;
margin:0;
padding:0;
}
h1{
position:absolution;
top:0;
left:0;
right:0;
height:20px;
font-weight:normal;
font-size:18px;
border-bottom:1px solid rgb(200,200,200);
background:white;
margin:0;
padding:5px;
}
div#container{
position:absolution;
top:31px;
bottom:0;
right:0;
left:0;
height:20px;
over-flow:auto;
padding:0 10px;
line-height:2em;
}
For IE 6 to properly stretch the absolutely positioned elements, it needs a bit of help. The workarounds appear in Figure 11-18b.

h1{
width:expression(documentElement.offsetWidth);
}
div#container{
top:32px;
width:expression(documentElement.offsetWidth-21);
height:expression(documentElement.offsetHeight-35);
}

html内容如下:
<body>
<h1>safasd</h1>
<div id="container">
<p>sdfasfsd</p>
<p>sdfsdg</P>
</div>
</body>
街头小贩 2010-01-27
  • 打赏
  • 举报
回复
在sams下的示例中没有数值.11章是: Backgrounds and Background Colors
示例下载:
http://www.informit.com/store/product.aspx?isbn=0672329069
kiba518 2010-01-27
  • 打赏
  • 举报
回复
我晕。。。还有这样问问题的

比我还不会问 问题
街头小贩 2010-01-27
  • 打赏
  • 举报
回复
这本书我有从头读到尾!没发现LZ说的问题!我回家瞧瞧
fengxingdotnet 2010-01-27
  • 打赏
  • 举报
回复
必须要加单位呀。。。。
sohighthesky 2010-01-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 cs5276 的回复:]
。。。。楼主,给我们买本那个书吧,买完给你看看,呵呵
[/Quote]
[Quote=引用 3 楼 msdnlu 的回复:]
把那一段内容描述一下。
你是在做《CSS入门经典》的广告吗
[/Quote]
msdnlu 2010-01-27
  • 打赏
  • 举报
回复
把那一段内容描述一下。
你是在做《CSS入门经典》的广告吗
cs5276 2010-01-26
  • 打赏
  • 举报
回复
。。。。楼主,给我们买本那个书吧,买完给你看看,呵呵
bhbhxy 2010-01-26
  • 打赏
  • 举报
回复
把完整代码发出来

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧