最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Child CSS not working for some of the classes - twenty seventeen theme

matteradmin8PV0评论

Parent and child CSS both classes loading as per CSS rules, but parent is functioning and child failing.

.navigation-top {
    background: #fff;
    border-bottom: 1px solid #eee;
    border-top: 1px solid #eee;
    font-size: 16px;
    font-size: 1rem;
    position: relative;
}

.navigation-top {
    background-color: #eeeeee;
    border-bottom: 2px solid #e60909;
}

My functions.php is shown below:

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
  wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>

Parent and child CSS both classes loading as per CSS rules, but parent is functioning and child failing.

.navigation-top {
    background: #fff;
    border-bottom: 1px solid #eee;
    border-top: 1px solid #eee;
    font-size: 16px;
    font-size: 1rem;
    position: relative;
}

.navigation-top {
    background-color: #eeeeee;
    border-bottom: 2px solid #e60909;
}

My functions.php is shown below:

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
  wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
Share Improve this question edited Mar 26, 2019 at 20:54 norman.lol 3,2413 gold badges30 silver badges35 bronze badges asked Mar 26, 2019 at 20:25 Nityanand ShetNityanand Shet 31 bronze badge 1
  • Remove that closing ?> PHP tag from your functions.php. – norman.lol Commented Mar 26, 2019 at 20:39
Add a comment  | 

1 Answer 1

Reset to default 0

You should type with

!important;

Tag with css like these it will work

.navigation-top { background-color: #eeeeee !important; border-bottom: 2px solid #e60909 !important; }
Post a comment

comment list (0)

  1. No comments so far