评论
包含评论的样式,例如网站上的博客部分。
评论组件包括评论本身,评论标题(包括头像、标题和元文本)以及评论正文。
类 |
描述 |
.uk-comment |
添加此类以定义评论组件。 |
.uk-comment-body |
添加此类以创建评论正文。 |
.uk-comment-header |
添加此类以创建评论标题。 |
.uk-comment-title |
将此类添加到标题以创建评论标题。 |
.uk-comment-meta |
添加此类以创建有关评论的元文本,例如 子导航。 |
.uk-comment-avatar |
将此类添加到 <img> 元素以创建评论作者的头像。 |
<article class="uk-comment">
<header class="uk-comment-header">
<img class="uk-comment-avatar" src="" width="" height="" alt="">
<h4 class="uk-comment-title"></h4>
<ul class="uk-comment-meta uk-subnav"></ul>
</header>
<div class="uk-comment-body"></div>
</article>
<article class="uk-comment" role="comment">
<header class="uk-comment-header">
<div class="uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<img class="uk-comment-avatar" src="images/avatar.jpg" width="80" height="80" alt="">
</div>
<div class="uk-width-expand">
<h4 class="uk-comment-title uk-margin-remove"><a class="uk-link-reset" href="#">Author</a></h4>
<ul class="uk-comment-meta uk-subnav uk-subnav-divider uk-margin-remove-top">
<li><a href="#">12 days ago</a></li>
<li><a href="#">Reply</a></li>
</ul>
</div>
</div>
</header>
<div class="uk-comment-body">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</div>
</article>
要以不同的方式设置评论的样式,例如将其突出显示为管理员的评论,只需添加 .uk-comment-primary
类。
<article class="uk-comment uk-comment-primary">…</article>
<article class="uk-comment uk-comment-primary" role="comment">
<header class="uk-comment-header">
<div class="uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<img class="uk-comment-avatar" src="images/avatar.jpg" width="80" height="80" alt="">
</div>
<div class="uk-width-expand">
<h4 class="uk-comment-title uk-margin-remove"><a class="uk-link-reset" href="#">Author</a></h4>
<ul class="uk-comment-meta uk-subnav uk-subnav-divider uk-margin-remove-top">
<li><a href="#">12 days ago</a></li>
<li><a href="#">Reply</a></li>
</ul>
</div>
</div>
</header>
<div class="uk-comment-body">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</div>
</article>
将 .uk-comment-list
类添加到 <ul>
元素以创建评论列表。您可以在评论列表中嵌套任意数量的 <ul>
元素。
<ul class="uk-comment-list">
<li>
<article class="uk-comment">…</article>
<ul>
<li>
<article class="uk-comment">…</article>
</li>
</ul>
</li>
</ul>
<ul class="uk-comment-list">
<li>
<article class="uk-comment uk-visible-toggle" tabindex="-1" role="comment">
<header class="uk-comment-header uk-position-relative">
<div class="uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<img class="uk-comment-avatar" src="images/avatar.jpg" width="80" height="80" alt="">
</div>
<div class="uk-width-expand">
<h4 class="uk-comment-title uk-margin-remove"><a class="uk-link-reset" href="#">Author</a></h4>
<p class="uk-comment-meta uk-margin-remove-top"><a class="uk-link-reset" href="#">12 days ago</a></p>
</div>
</div>
<div class="uk-position-top-right uk-position-small uk-hidden-hover"><a class="uk-link-muted" href="#">Reply</a></div>
</header>
<div class="uk-comment-body">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</div>
</article>
<ul>
<li>
<article class="uk-comment uk-comment-primary uk-visible-toggle" tabindex="-1" role="comment">
<header class="uk-comment-header uk-position-relative">
<div class="uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<img class="uk-comment-avatar" src="images/avatar.jpg" width="80" height="80" alt="">
</div>
<div class="uk-width-expand">
<h4 class="uk-comment-title uk-margin-remove"><a class="uk-link-reset" href="#">Author</a></h4>
<p class="uk-comment-meta uk-margin-remove-top"><a class="uk-link-reset" href="#">12 days ago</a></p>
</div>
</div>
<div class="uk-position-top-right uk-position-small uk-hidden-hover"><a class="uk-link-muted" href="#">Reply</a></div>
</header>
<div class="uk-comment-body">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</div>
</article>
</li>
<li>
<article class="uk-comment uk-visible-toggle" tabindex="-1" role="comment">
<header class="uk-comment-header uk-position-relative">
<div class="uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<img class="uk-comment-avatar" src="images/avatar.jpg" width="80" height="80" alt="">
</div>
<div class="uk-width-expand">
<h4 class="uk-comment-title uk-margin-remove"><a class="uk-link-reset" href="#">Author</a></h4>
<p class="uk-comment-meta uk-margin-remove-top"><a class="uk-link-reset" href="#">12 days ago</a></p>
</div>
</div>
<div class="uk-position-top-right uk-position-small uk-hidden-hover"><a class="uk-link-muted" href="#">Reply</a></div>
</header>
<div class="uk-comment-body">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</div>
</article>
</li>
</ul>
</li>
</ul>
将适当的 WAI-ARIA 角色、状态和属性设置为评论组件。
<ul class="uk-comment-list">
<li>
<article class="uk-comment" role="comment">…</article>
<ul>
<li>
<article class="uk-comment" role="comment">…</article>
</li>
</ul>
</li>
</ul>
作者
12 天前
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
作者
12 天前
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
作者
12 天前
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.