admin管理员组

文章数量:1026989

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; }

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; }

本文标签: Child CSS not working for some of the classestwenty seventeen theme