简体   繁体   English

设置关于WP的评论的样式

[英]Styling the comments of a post on WP

I can't stylize the elements that only show on the page when it has comments ( <comments> , <commentlist> etc) with the CSS file. 当CSS文件带有注释( <comments><commentlist>等)时,我无法样式化仅显示在页面上的元素。 I got it to work like 我让它像

<?php here it calls the comments if any ?>
<style>
 .comments{}
</style>

I would like to know why this happens and if there is any better way to deal with this. 我想知道为什么会这样,以及是否有更好的方法来解决这个问题。 Thanks 谢谢

Derik 德里克

There is no need to dynamically add CSS by PHP. 无需通过PHP动态添加CSS。

If you are not using the header(“Content-type: text/css”); 如果您没有使用header(“Content-type: text/css”); before output, then CSS, which has been dynamically produced, will slow down your page. 在输出之前,动态生成的CSS会减慢页面速度。 It will behave as internal CSS, therefore the better solution is to cache it. 它的行为就像内部CSS,因此更好的解决方案是对其进行缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM