html:
<div data-placeholder="模拟placeholder"></div>
css:
/*为空时显示 element attribute content*/ div:empty:before { content: attr(data-placeholder); /* element attribute*/ /*content: 'this is content';*/ color: red; } /*焦点时内容为空*/ div:focus:before { content: none;//如果获取焦点时想展示placeholder,那么注释掉这个就行 }