php - WordPress 更改主题中内联的 css 值

标签 php html wordpress

我正在使用这个wordpress theme我需要更改主页上 div 类中的值。 这个div类是

<div class="vertical-center">

还有内联值

style="padding-top: 132px;

我试图找到这个值的设置在哪里

  • 使用文本编辑器搜索文件(.js、.css、.php):无
  • 管理中的主题选项设置:无
  • 进入 mysql 数据库:无

并且这个值不会出现在源页面中,但是您可以使用检查器(使用chrome)看到它

这个值在哪里以及如何更改它??? 谢谢

最佳答案

padding-top 样式由事件主题文件夹中 /javascripts/main.js 内的一些 JavaScript 应用(dignity)。

应用此样式的行是:

 //Vertical Centering of natural content spcific elements (non-images)
 $(function ($) {
          /*if your element is an image then please use $(window).load() instead tha above function wrap, because we want the coding to take
          effect when the image is loaded. */

          //get the width of the parent
          var parent_height = $('.vertical-center').parent().height();
          var image_height = $('.vertical-center').height();

          var top_margin = (parent_height - image_height)/2;

          //center it
          $('.vertical-center').css( 'padding-top' , top_margin);
          //uncomment the following if ithe element to be centered is an image
          $('.vertical-center-img').css( 'margin-top' , top_margin);
   });

如果您想删除它,一种选择是使用 CSS:

.vertical-center {
    padding-top: 0 !important;
}

.vertical-center-img {
    margin-top: 0 !important;
}

通过使用!important,您将覆盖内联样式。

确保您在子主题或适当的区域中执行此操作以添加自定义 CSS,以避免在更新主题时它被覆盖。

关于php - WordPress 更改主题中内联的 css 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24140481/

相关文章:

php - Codeigniter 通过链接获取行详细信息(foreach)

html - 背景图像重复页面的全高?

error-handling - fatal error : Call to undefined function is_user_logged_in()

php - MySQL 到 XML

PHP - 确保 GET 请求来自特定域

android - 圆形框上的边框未在 Android/Chrome 上显示

wordpress - 以编程方式在 WooCommerce 中使用可变产品和两个属性和术语

php - Mysql 查询以检查对私有(private)页面的访问

javascript - 从数组添加动态覆盖

通过 SSL 提供服务时,Wordpress CSS 在 Chrome 中中断