特定帖子中 Wordpress 的 CSS [英] CSS for Wordpress in a specific post

查看:23
本文介绍了特定帖子中 Wordpress 的 CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了几个小时来让一些图像在 Wordpress 帖子中水平显示.当我单击 "text" 时,我可以添加一个 div 类,因此我尝试向 div 添加内联样式(因为我不想调整整个站点的整个 css).我安装了一个插件自定义 css",它似乎也不起作用.

I have been trying for several hours to get some images to display horizontally in a Wordpress post. When I click "text" , I can add a div class so I have tried adding inline styling to the div (as I do not want to adjust the entire css for the entire site). I installed a plugin "custom css" which doesn't seem to work either.

我也尝试过对图像本身进行样式设置

I have also tried styling the image itself

img style="display: inline; margin: 0 5px;" src="blah blah" 

我的想法很新鲜,准备拔掉我剩下的头发.

I am fresh out of ideas and ready to pull out what hair I have left.

推荐答案

如果您想添加自定义样式或仅覆盖特定帖子而不影响其他帖子,可以使用 2 种方法.

If you want to add a custom style or override a specific post only without affecting to other posts, 2 approaches can be used.

  1. 使用像 https://wordpress.org/plugins 这样的插件/postpage-specific-custom-css/

如果用例比较简单,我们可以在Appearance的自定义CSS区域内添加如下自定义样式->自定义 ->一般 ->自定义 CSS/Js

If the use case is simple, we can add a custom style as follows inside the custom CSS area in Appearance -> Customize -> General -> Custom CSS/Js

添加新样式

#post-[WP-ID-OF-THE-POST] { /* YOUR STYLE HERE */ }

覆盖现有样式

#post-[WP-ID-OF-THE-POST] .nav_area{ /* YOUR STYLE HERE */ }

例如:-

   #post-100 {
    /* YOUR STYLE HERE */
    }

100 是特定帖子的 ID.

100 is the ID of the specific post.

参考:https://theme4press.com/give-wordpress-post-独特风格/

这篇关于特定帖子中 Wordpress 的 CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆