【发布时间】:2011-01-14 02:34:56
【问题描述】:
好的,问题很简单:
我有一个可变宽度和高度的 div,我想在它旁边放置另一个“元素”,它基本上是一个由 3 个组件(顶部固定、中间可变高度、底部固定)组成的栏,就像任何滚动条。而且,就像任何滚动条一样,我希望始终是它“附加”到的 div 的大小,而不管它的大小和调整大小。
下面的代码可以做到这一点(我还没有找到更好的方法,如果你找到了,请告诉我:))
但现在这是诀窍。如果您将文件名从 test.html 更改为 test.xhtml(就是这样!),它将停止工作。查看示例(在 Firefox 中)并亲自查看(在 Chrome 中有效)
http://stefan.apsaa.eu/test/test.html - 然后只需在 test.html 前面放一个“x”,然后再次按回车键......在 firefox 中......
所以。如果你们知道如何解决它,或者知道一种同时适用于 xhtml 和 html 的更好方法,我将不胜感激
明确一点:我想要一个 VARIABLE WIDTH 和 HEIGHT :)(滚动条只是作为示例)
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:svg="http://www.w3.org/2000/svg" xml:lang="en-ca">
<head>
<style>
.handle{
width : 5px;
height : 100% !important;
margin : 0;
padding : 0;
overflow : hidden;
}
.handle a{
position : relative;
display : inline-block !important;
height : 100% !important;
text-decoration : none;
}
.handle a:hover{
height : 100% !important;
}
.handle-top{
background : url(images/borders/standard/border-top.png) no-repeat 0 0;
height : 100% !important;
}
.handle-middle{
background : url(images/borders/standard/border-mid.png) repeat-y 0 0;
height : 100% !important;
}
.handle-bottom{
background : url(images/borders/standard/border-bot.png) no-repeat 0 100%;
height : 100% !important;
}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0" class="wrapper" style="margin: 0px;">
<tbody>
<tr>
<td class="handle">
<a href="#">
<div class="handle-top">
<div class="handle-bottom">
<div class="handle-middle">!</div>
</div>
</div>
</a>
</td>
<td width="100%" class="contentHolder">
<div class="section tCollapsible" style="margin: 0px;">
<h4>This is a DIV</h4>
Test<br />asdsa
</div>
</td>
</tr>
</tbody>
</table>
</body>
</html>
【问题讨论】:
-
用于布局的表格?不不不不不不不不不!
-
这是一个 javascript 应用程序......所以还不错
-
如果你找到了无表的方式,请分享
-
您的页面未通过验证。这可能是原因
标签: html css firefox xhtml height