CSS: content:"\00a0"

Today I came across a new CSS syntax that I have never seen before

content:"0a0";

Checking it on w3schools, it explains:

Definition and Usage

The content property is used with the :before and :after pseudo-elements, to insert generated content.

My question is, can you point out to me in real world example, how do we use this content property? And what does the 0a0 mean in this case?


我已经使用它在浮动列表上实现样式文本

#horz-list li {
  list-style: none;
  float: left;
}

#horz-list li:after {
  content: "0a0-0a0";
}

 #horz-list li:last-child:after {
  content: "";
}
<ul id="horz-list">
  <li>first item</li>
  <li>second item</li>
  <li>third item</li>
</ul>

The content property is used to add content or even adding html entities. As for 0a0 , it is hex code for a non-breaking space.

Resources:

More Information
Javascript, CSS, and (X)HTML entities in numeric order

链接地址: http://www.djcxy.com/p/15552.html

上一篇: 我可以使用哪些“clearfix”方法?

下一篇: CSS:内容:“\ 00a0”