我正在尝试基于 wordpress 模板建立自己的网站。有一个主要问题:文章在 html 中设置了它自己的元素样式,但我无法在 style.css 或任何其他文件中找到它 这是我得到的:
<article id="post-26" class="post-item post-26 post type-post status-publish format-standard has-post-thumbnail hentry category-uncategorized" style="position: absolute; left: 0px; top: 0px;">
这是我的 archive.php:
<article id="post-<?php the_ID(); ?>" <?php post_class('post-item'); ?>>
如何删除绝对位置?
最佳答案
如果只有几页出现问题,我会使用 JavaScript 解决 WordPress 中的设计问题(当 custom style.css 不够时)。
编辑绝对<article>
所在的页面/帖子来自您的仪表板(.../wp-admin)。切换到“文本” View (不是“视觉”)。在文本框中任何文本的末尾插入以下代码。
<script>
document.getElementById('post-26').style.position = null;
</script>
这里我们只是使用它的 ID 选择元素,removing the style的 position
.
关于html - 我如何更改 <article> php 元素样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53325258/