We would like to know how to insert element to into Div with pseudo-element.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.text1, .text2 {<!-- w ww . j av a 2s. c om-->
width: 200px;
padding: 8px 12px;
display: block;
background-color: #EEE;
margin: 5px;
height: 20px;
}
.text1 {
height: 28px;
padding: 0px 12px 8px 12px;
}
.text1:before {
content: "";
background: red;
display: block;
position: relative;
width: 20px;
height: 10px;
left: 110px;
top: 15px;
}
</style>
</head>
<body>
<div class="text1">Text 1</div>
<div class="text2">Text 2</div>
</body>
</html>
The code above is rendered as follows: