10 09/2014

img :after not work

最后更新: Wed Sep 10 2014 12:29:11 GMT+0800

img:after 或者 input:after 没用!因为

img 是 replaced element。其它 object,embed,input,button,textarea,select 这些都是。类似于“控件”的感觉,它们的样子由“控件”决定而不是浏览器。

A replaced element is any element whose appearance and dimensions are defined by an external resource. Examples include images (<img> tags), plugins (<object> tags), and form elements (<button>, <textarea>, <input>, and <select> tags). All other elements types can be referred to as non-replaced elements.

:before 和 :after 只能和那些 non-replaced elements 配合。