您可以将它们放在 a中,并对非屏幕阅读器<dl>
隐藏s。<dt>
例如,HTML:
<dl>
<dt>Start time</dt>
<dd><time datetime="{{ start_time }}">{{ start_time|time:"H:i" }}</time></dd>
<dt>End time</dt>
<dd><time datetime="{{ end_time }}">{{ end_time|time:"H:i" }}</time></dd>
</dl>
CSS(来自HTML5 样板 .visuallyhidden
)
/*
* Hide only visually, but have it available for screenreaders: h5bp.com/v
*/
dt {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
dd {
display: inline;
}
dt:first-child + dd::after {
content: ' \2013 '
}
更新:jsFiddle、dd
style 和 en-dash 而不是连字符