好的,我使用XHTML1.1的原因是HTML5 ...的运行方式不符合我的预期,如果有人可以提供一个不错的教程,我很乐意看一下,到目前为止,我用HTML5编写的任何内容都不会除了Chrome> _>之外,无法在其他任何浏览器中呈现; 。
现在回到我的问题。
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style>
#Content{
position: relative;
background-color: #8CF;
padding: 1%;
border-color: black;
border-style: solid;
border-left-width: 1px;
border-right-width: 1px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
height: 100%;
}
#Announcer {
position: relative;
background-color: #6AF;
padding: 1%;
border-color: #6AFFFF;
border-width: 1px;
border-style: inset;
}
#Column_Holder {
position: relative;
background-color: #6CF;
padding: 1%;
height: 100%;
}
.Column {
float: left;
padding: 1%;
overflow: auto;
height: 100%;
}
#Col1 {
width: 60%;
border-color: black;
border-style: solid;
border-right-width: 1px;
border-width: 1px;
}
#Article_Image {
background-color: #3DE;
position: relative;
float: right;
width: 20%;
text-align: right;
}
#Col2 {
width: 30%;
padding-left: 3%;
}
</style>
</head>
<body>
<div id="Content">
<div id="Announcer">
<h2>Announcer Place Holder</h2>
</div>
<div id="Column_Holder">
<div class="Column" id="Col1">
<div id="Article_Image">Image PlaceHolder</div>
<h1>Lots a text</h1>
<p>Creating Websites since 1989. I have created lots and lots of websites. This one is with XHTML1.1 and CSS3</p>
</div>
<div class="Column" id="Col2">
<h2>Another story</h2>
<p>Something else happened teh other day =3</p>
</div>
</div>
</div>
</body>
</html>
我试过使用浮点数...在这种情况下不适合作为解决方案。我已经尝试过100%的高度,Xhtml似乎完全忽略了该指令。除非我声明一个像素高度,否则它会被奇怪地忽略(是的,我正在努力解决与HTML的区别)。有人想提供提示吗?只是一个关键字> _
谢谢阅读
最佳答案
首先,认真吗? XHTML是否没有XHTML doctype?
百分比是相对度量单位。这意味着无论您放置百分比尺寸,它都取决于父级。现在,width不需要父级声明具有相对性的width,而height则需要。由于#Content
是身体的孩子,因此您需要身体具有一个高度(例如说100%)。 body是<html>
标记的子元素,要使body的100%起作用,您需要100%的html。
将此插入您的CSS之上,以查看我的意思:
html,body{height:100%;}
关于css - XHTML忽略高度,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9338615/