插入换行
使用content: '\A'
的伪元素,可以让元素换行。
<dl>
<dt>Name:</dt>
<dd>Lea Verou</dd>
<dt>Email:</dt>
<dd>lea@verou.me</dd>
<dd>leaverou@mit.edu</dd>
<dt>Location:</dt>
<dd>Earth</dd>
</dl>
dt,
dd {
display: inline;
margin: 0;
}
dd {
font-weight: 600;
}
dd + dt::before {
content: "\A";
white-space: pre;
}
dd + dd::before {
content: ", ";
font-weight: normal;
margin-left: -0.25em;
}
- Name:
- Lea Verou
- Email:
- lea@verou.me
- leaverou@mit.edu
- Location:
- Earth