textarea默认有个resize样式,效果就是下面这样

读 《css 揭秘》时发现两个亮点:

  • 其实这个属性不仅适用于 textarea 元素,适用于下面所有元素:

elements with overflow other than visible, and optionally replaced elements representing images or videos, and iframes

  • 你可以通过伪元素来覆盖原有的样式,而且不会影响原有的resize功能,但是其他元素不行。

这一点,可能不太好理解,举个例子,我们用一个span来覆盖右下角的按钮

<div>
div
<span>
span
</span>
</div>
div {
width:100px;
height:100px;
background-color:pink;
resize:horizontal;
overflow:hidden;
position:relative;
}
span {
content:'';
display:block;
width:20px;
height:20px;
background-color:yellowgreen;
position:absolute;
right:0;
bottom:0;
}

效果是这样,resize功能失效了:

但是,如果把 span换成伪元素,就是可以的:

<div>
div
<span>
span
</span>
</div>
div {
width:100px;
height:100px;
background-color:pink;
resize:horizontal;
overflow:hidden;
position:relative;
}
div::after {
content:'';
display:block;
width:20px;
height:20px;
background-color:yellowgreen;
position:absolute;
right:0;
bottom:0;
}

resize功能还是在的:

这就非常神奇了。

最新文章

  1. 10年微软MVP路(如何成为一个MVP?)
  2. js倒计时跳转页面
  3. 坑!坑!坑!防不胜防的unsigned int的运算
  4. linux中ONBOOT=yes的含义
  5. 注册asp.net
  6. linux内核分析 第八周
  7. eclipse ADT下载地址
  8. Docker系列(四)Dockerfile
  9. hdu 1102 Constructing Roads(最小生成树 Prim)
  10. selenium之多线程启动grid分布式测试框架封装(二)
  11. Codeforce 水题报告(2)
  12. windows的bat脚本
  13. BZOJ 3379: [Usaco2004 Open]Turning in Homework 交作业
  14. php函数 array_count_values
  15. 爬虫基础(四)-----MongoDB的使用
  16. 【ES】学习3-请求体查询
  17. (转)winform之ListView
  18. JMeter性能(压力)测试--使用解锁
  19. Spring Security基本配置
  20. Root :: AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 5. Dynamic Programming

热门文章

  1. springboot+jps+druid项目搭建
  2. C#WinForm窗体事件执行次序
  3. DBA操作
  4. Netty权威指南之BIO(Block Input/Output,同步阻塞I/O通信)通信模型
  5. vs2010,vs2012如何连接vss2005,vss2008
  6. Linux关闭Tomcat为什么要用Kill,而不是shutdown.sh
  7. Jquery easyui 重置按钮,easyui 清空表单,Jquery easyui 重置表单
  8. hive-数据模型
  9. 常见C语言编译错误解析【转】
  10. myeclipse使用小技巧