简体   繁体   English

如何使文本框缩放以填满整个屏幕

[英]How do I make a textbox scale to fill the whole screen

I'm making a little site where you can make books, and I'm having problems with making a textbox.我正在制作一个可以制作书籍的小网站,但我在制作文本框时遇到了问题。 The problem is when you make the textbox with some settings to it…问题是当你用一些设置来制作文本框时......

 #text { background-color: white; border-radius: 10px; border: 4px #008f7e solid; height: 60%; margin: auto; display: table; font-size: 45%; }
 <textarea rows="27" cols="50" id="text"></textarea>

Notice how I added some preset rows and columns to this.请注意我是如何向其中添加一些预设行和列的。 I want it to fill the whole screen vertically but if I set the width to something my preset rows and columns disappear.我希望它垂直填满整个屏幕,但如果我将宽度设置为某个值,我的预设行和列就会消失。 My expectation is that I don't loose my rows and columns but fill the whole screen.我的期望是我不会松开我的行和列,而是填满整个屏幕。 It works perfectly when you're using a small screen (you can see a photo of it here ) but when I use a bigger screen it either shows up small or fills the rows and columns disappear (you can see right here .) I've tried everything from changing the display to block to changing the size of the font to crying in the corner but nothing seems to work.当你使用一个小屏幕时它工作得很好(你可以在这里看到它的照片)但是当我使用一个更大的屏幕时它要么显示小或者填充行和列消失(你可以在这里看到。)我'我已经尝试了所有方法,从更改显示到块到更改字体大小再到在角落里哭泣,但似乎没有任何效果。 Please help!请帮忙!

Update I'm giving up on this project because I can't find a fix for this.更新我放弃了这个项目,因为我找不到解决这个问题的方法。 Thanks for trying.感谢您的尝试。

Have you tried to resize attribute textarea?您是否尝试过调整属性文本区域的大小? I hope I understand what you want, this is my solution.我希望我明白你想要什么,这是我的解决方案。 Hope this helps!希望这可以帮助!

 #text { background-color: white; border-radius: 10px; border: 4px #008f7e solid; min-height: 60%; margin: auto; font-size: 45%; width:100%; }
 <textarea rows="27" cols="50" id="text" value="">Notice how I added some preset rows and columns to this. I want it to fill the whole screen vertically but if i set the width to something my preset rows and columns disappear. My expectation is that I don't loose my rows and columns but fils the whole screen.</textarea>

you can add width and height to styles.您可以将widthheight添加到 styles。

 body,html{ height: 100%; margin: 0; } #text { box-sizing: border-box; background-color: white; border-radius: 10px; border: 4px #008f7e solid; height: 100%; margin: auto; display: table; font-size: 45%; width: 100%; }
 <textarea id="text"></textarea>

With height: 100vh;height: 100vh; you can achieve this.你可以做到这一点。

 * { padding: 0; margin: 0; } #text { box-sizing: border-box; background-color: white; border-radius: 10px; border: 4px #008f7e solid; height: 100vh; margin: auto; display: table; width: 100%; padding:20px; }
 <textarea id="text">some text</textarea>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM