以下是代码,在IE中存在一些小问题。
在Chrome和Firefox中,设计效果很完美,但IE中的textarea尺寸非常小。我希望它看起来像Firefox或Chrome中的样子。
可能是重复的
Consistently sizing a <textarea> under IE, FF, Safari/Chrome
或者
Firefox / IE textarea sizing quirk - workarounds?
但没有提到适当的解决方案。所以我开始了这个。
我相信jQuery可以解决它,但我只想在我的页面中使用CSS,有没有适当的CSS解决方案?
我无法登录jsFiddle,所以没有jsFiddle的支持.. :(
<!DOCROOT html>
<html>
<head>
<meta charset="utf-8" />
<title>Code Compressor</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.container {
width: 100%;
overflow: hidden;
}
.column {
width: 48%;
margin: 1%;
float: left;
}
textarea {
min-width: 100%;
max-width: 100%;
min-height: 80%;
max-height: 80%;
overflow: auto;
}
.center {
clear: both;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<div class="column">
<div>Input Source:</div>
<textarea id="sourceCode" name="sourceCode" ></textarea>
</div>
<div class="column">
<div>Compressed Output:</div>
<textarea id="outputCode" name="outputCode" ></textarea>
</div>
<div class="center">
<input type="button" id="compressButton" name="compressButton"
value="Compress" onClick="compress" />
</div>
</div>
</body>
</html>
width: 100%; height: 80%
,会发生什么? - Aguardientico.column
的高度只有一行。尝试给你的.column
添加一个高度,例如300像素。 - Guilherme Oderdenge