textarea
默認有個resize
樣式,效果就是下面這樣css
讀 《css 揭祕》時發現兩個亮點:html
textarea
元素,適用於下面全部元素:elements with overflow other than visible, and optionally replaced elements representing images or videos, and iframeside
resize
功能,可是其餘元素不行。這一點,可能不太好理解,舉個例子,咱們用一個span
來覆蓋右下角的按鈕spa
<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
功能失效了:code
可是,若是把 span
換成僞元素,就是能夠的:htm
<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
功能仍是在的:blog
這就很是神奇了。element