Rexdf

The devil is in the Details.

Css生成内容

| Comments

css即层叠样式表(Cascading Style Sheets),一般主要是用来修饰效果,页面布局等。但是也是可以用来修改内容的,这在有些时候非常有用。

html:

htmlMyBlog
<div class="task" data-task-owner="Joe">mop kitchen</div>
<div class="task" data-task-owner="Charles" data-apos="1">vacuum hallway</div>

css:

cssMyBlog
div.task:before { content: attr(data-task-owner)"'s task - " ; }
div.task[data-apos]:before { content: attr(data-task-owner)"' task - " ; }

result:

Joe's task - mop kitchen
Charles' task - vacuum hallway

Comments