我正试图转换一个html主题与Wordpress工作,我被困在一个相当简单的代码,我不明白为什么。
为什么这个代码:
<div class="project-category text-faded">
test
</div>
和这个不一样(CSS不工作)?
<div class="project-category text-faded">
<?php the_category(); ?>
</div>
<a href="-----/category/test/" rel="category tag">Test</a> as output of <?php the_category(); ?>
<a href="-----/category/test/" rel="category tag">Test</a>
根据上面的注释,这是PHP函数的输出。当你硬编码字符串Test
时,你的CSS工作得很好,但当你得到上面的输出时就不一样了。那只意味着一件事。
你的css样式不适合a
标签在这些类project-category text-faded
或a
标签是不同的风格。所以你的a
标签的样式应该适合这两种,这样就可以了