---
title: "css中的after"
author: "piperzero"
date: "2013-06-15T22:31:00Z"
tags: []
slug: "css-after"
draft: false
lastmod: "2013-07-16T08:31:50Z"
id: 1906880
url: "https://piperzero.iteye.com/blog/1906880"
---

```
:after 伪元素在元素之后添加内容。

这个伪元素允许创作人员在元素内容的最后面插入生成内容。默认地，这个伪元素是行内元素，不过可以使用属性 display 改变这一点。

所有主流浏览器都支持 :after 伪元素，但对于IE来说，只有IE8以上版本支持。

h1:after
  {
  content:url(beep.wav);
  }

此样式会在每个 h1 元素之后播放一段声音：

<style type="text/css">
h1:after {content:url(/i/w3school_logo_white.gif)}
</style>

<h1>This is a heading</h1>
```