【问题标题】:how to change li class bg color如何更改 li class bg 颜色
【发布时间】:2014-08-28 09:13:25
【问题描述】:

如何为这个 li 类添加背景? 例如,我想将代码添加到蓝色。 我需要添加什么

我需要在哪里添加?

tnx !

<li class="tribe-events-list-widget-events <?php tribe_events_event_classes() ?>">

    <?php do_action( 'tribe_events_list_widget_before_the_event_title' ); ?>
    <!-- Event Title -->
    <h2 class="entry-title summary">
        <a href="<?php echo tribe_get_event_link(); ?>" rel="bookmark"><?php the_title(); ?></a>
    </h2>

    <?php do_action( 'tribe_events_list_widget_after_the_event_title' ); ?> 
    <!-- Event Time -->

    <?php do_action( 'tribe_events_list_widget_before_the_meta' ) ?>

    <div class="duration">
        <?php echo tribe_events_event_schedule_details(); ?>
    </div>

    <?php do_action( 'tribe_events_list_widget_after_the_meta' ) ?>
</li>

【问题讨论】:

  • 您要更改为li 的项目符号的背景吗?
  • 使用 PHP 无法直接更改背景颜色。您需要使用 CSS。你有 CSS 文件吗?
  • 不,我要添加文字的背景色
  • 那么你有什么尝试?!您是否在整个互联网上搜索了答案? @user1461642
  • 这个问题已经回答了here和here

标签: php css


【解决方案1】:

css:

li.tribe-events-list-widget-events {

background-color: blue;

}

【讨论】:

  • 写入一个名为“xyz.css”的新文件。在您的 html 文件中,在 head 中插入链接标签:
  • 我创建了一个 CSS 文件并将您在上面提到的内容放入其中。我用我打开 php 文档顶部 现在呢?
  • 如果插入正确,应该会看到颜色变化。
  • 我创建了一个 CSS 文件可能是什么问题我把 li.tribe-events-list-widget-events { background-color: blue;在 PHP 文件中我把 php 还有那个
【解决方案2】:
You are using this code have you checked your function return the class "<?php tribe_events_event_classes() ?>". If yes then try this code:-

">

<?php do_action( 'tribe_events_list_widget_before_the_event_title' ); ?>
<!-- Event Title -->
<h2 class="entry-title summary">
    <a href="<?php echo tribe_get_event_link(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h2>

<?php do_action( 'tribe_events_list_widget_after_the_event_title' ); ?> 
<!-- Event Time -->

<?php do_action( 'tribe_events_list_widget_before_the_meta' ) ?>

<div class="duration">
    <?php echo tribe_events_event_schedule_details(); ?>
</div>

<?php do_action( 'tribe_events_list_widget_after_the_meta' ) ?>

【讨论】:

  • 我有一个 PHP 文件,我想在代码中添加背景颜色。
  • 如何在他的代码中添加 bgcolor?
  • 它正在使用内联 css 。只需对您的 li 标签使用相同的方法
猜你喜欢
  • 1970-01-01
  • 2019-02-18
  • 1970-01-01
  • 2021-11-22
  • 2020-12-01
  • 1970-01-01
  • 2019-04-06
  • 2017-07-14
  • 1970-01-01
相关资源
最近更新 更多