有没有一种方法可以在没有额外 CSS 文件的情况下使 Textarea 全屏显示?
Is There A Way I Can Make A Textarea Fullscreen Without An Extra CSS File?
我想在没有插件的情况下制作全屏 TextArea CSS 文件并且不删除文本?
<html>
<title>TextArea</title>
<body>
<textarea spellcheck="true"></textarea>
<p>TextArea</p>
</body>
</html>
<html>
<title>TextArea</title>
<body>
<textarea spellcheck="true" style="width: 100%;
height: 100vh;"></textarea>
<p>TextArea</p>
</body>
</html>
如果您不想创建单独的 CSS 样式表,可以添加内联样式。
使用内联样式:
<html>
<head>
<title>Fullscreen Textarea</title>
<body style="width:100px; height:100px;">
<textarea style="width: 100%; height:100%;"></textarea>
</body>
</html>
或者,使用 <style>
标签:
<html>
<head>
<title>Fullscreen textarea</title>
</head>
<body>
<textarea id="textarea"></textarea>
</body>
<style>
body {
width: 100px;
height: 100px;
}
#textarea {
width: 100%;
height: 100%;
}
</style>
</html>
两者效果相同,但最好不要使用内联样式。
我想在没有插件的情况下制作全屏 TextArea CSS 文件并且不删除文本?
<html>
<title>TextArea</title>
<body>
<textarea spellcheck="true"></textarea>
<p>TextArea</p>
</body>
</html>
<html>
<title>TextArea</title>
<body>
<textarea spellcheck="true" style="width: 100%;
height: 100vh;"></textarea>
<p>TextArea</p>
</body>
</html>
如果您不想创建单独的 CSS 样式表,可以添加内联样式。
使用内联样式:
<html>
<head>
<title>Fullscreen Textarea</title>
<body style="width:100px; height:100px;">
<textarea style="width: 100%; height:100%;"></textarea>
</body>
</html>
或者,使用 <style>
标签:
<html>
<head>
<title>Fullscreen textarea</title>
</head>
<body>
<textarea id="textarea"></textarea>
</body>
<style>
body {
width: 100px;
height: 100px;
}
#textarea {
width: 100%;
height: 100%;
}
</style>
</html>
两者效果相同,但最好不要使用内联样式。