滚动条未显示在高度:30px 的文本区域中

发布于 2024-10-11 08:55:19 字数 343 浏览 6 评论 0原文

我今天正在帮助我的朋友。他遇到了一个问题,他想要一个带有滚动条的文本区域以 30px 的高度显示。不幸的是,如果我们给文本区域指定高度,则滚动条不会显示,但当我们使用鼠标滚动条/键盘上下导航键时它会起作用。

CSS

<style type="text/css">
.txtarea { height:50px; overflow-y:scroll;  }
</style>

Html

<textarea class="txtarea"></textarea>

请帮忙。

I am helping my friend today. He came across an issue that he wants a textarea to display in a height of 30px with scrollbar. Unfortunately if we give a height to the textarea the scrollbar is not shown but its working when we use the mouse scroller/keyboard up and down navigation keys.

Css

<style type="text/css">
.txtarea { height:50px; overflow-y:scroll;  }
</style>

Html

<textarea class="txtarea"></textarea>

Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

没有伤那来痛 2024-10-18 08:55:19
.txtarea {
    overflow-y: visible
}

还,
文本区域的高度必须至少约为 70 像素,否则框太小而无法显示滚动条。

http://jsfiddle.net/gTzPM/

.txtarea {
    overflow-y: visible
}

Also,
The text area has to be at least ~70px high otherwise the box is too small to show the scrollbar.

http://jsfiddle.net/gTzPM/

荒芜了季节 2024-10-18 08:55:19
<a class="submit" href="https://www.google.com/"target="_blank">
  <input type="button" value="Submit"  target="_blank" onclick="preventProp(event)"></a>
</body>
<script>
function preventProp(e){
  if(confirm("Are you sure you want to Submit ?")){
    return true;
  }
  else{
    e.preventDefault();
  }
}
</script>
<a class="submit" href="https://www.google.com/"target="_blank">
  <input type="button" value="Submit"  target="_blank" onclick="preventProp(event)"></a>
</body>
<script>
function preventProp(e){
  if(confirm("Are you sure you want to Submit ?")){
    return true;
  }
  else{
    e.preventDefault();
  }
}
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文