博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
表单文本域和文本区域_全宽文本区域
阅读量:2518 次
发布时间:2019-05-11

本文共 1064 字,大约阅读时间需要 3 分钟。

表单文本域和文本区域

Working with textarea widths can be painful if you want the textarea to span 100% width.  Why painful?  Because if the textarea's containing element has padding, your "width:100%" textarea will likely stretch outside of the parent container -- a frustrating prospect to say the least.  Luckily there's a quick CSS solution to this problem!

如果您希望文本区域跨越100%的宽度,则使用文本区域宽度可能会很痛苦。 为什么会痛? 因为如果textarea的包含元素具有填充,则您的"width:100%" textarea可能会延伸到父容器之外-至少可以说这是令人沮丧的前景。 幸运的是,有一个快速CSS解决方案可以解决这个问题!

CSS (The CSS)

box-sizing to the rescue!

box-sizing以进行救援!

textarea {	-webkit-box-sizing: border-box;	-moz-box-sizing: border-box;	box-sizing: border-box;	width: 100%;}

Setting the box-sizing to border-box allows the textarea to respect its parent container's padding and border, recalculating what 100% actually means.  If the box-sizing were content-box, the textarea would continue to stretch outside the parent container as it would have before.

box-sizing设置为border-box可使textarea尊重其父容器的填充和边框,重新计算100%实际含义。 如果box-sizingcontent-box ,则文本区域将像以前一样继续延伸到父容器之外。

翻译自:

表单文本域和文本区域

转载地址:http://tkvwd.baihongyu.com/

你可能感兴趣的文章
智能提示
查看>>
[JavaScript] 弹出编辑框
查看>>
一个消息队列MQ调试工具
查看>>
springmvc 访问时找不到配置文件
查看>>
采访吴岳师兄有感 by 王宇飞
查看>>
LVS简略介绍
查看>>
hdu 1021 Fibonacci Again
查看>>
JVM架构_XmnXmsXmxXss有什么区别:转
查看>>
PHPExcel 使用心得
查看>>
洛谷 P3374 【模板】树状数组 1(单点加,区间和)
查看>>
verilog 代码编写小记
查看>>
PyQT的安装和配置
查看>>
从 docker 到 runC
查看>>
python基础学习笔记(十一)
查看>>
守护进程
查看>>
第十二周作业
查看>>
php数组
查看>>
Linux 防火墙
查看>>
android 自定义图片圆形进度条
查看>>
互联网金融P2P主业务场景自动化测试
查看>>