I am new in wordpress developing, I try to edit my first blog, editing the menu was not painful, but the footer does not respect the css codes despite the stylesheet is the same.
Here is the code where I enqueue the css stylesheet file:
function load_stylesheets() {
/* loading my own stylesheet */
wp_register_style('style', get_template_directory_uri() . '/css/mainstyle.css', array(), false, 'all');
wp_enqueue_style('style');
}
add_action('wp_enqueue_scripts', 'load_stylesheets');
this is where I display my footer:
<footer class="footer">
<div class="container">
<div class="row">
<div class="footermenu col-md-4 col-xs-12 text-right">
<?php if (has_nav_menu('footer-menu')) : ?>
<nav><?php
wp_nav_menu(
array(
'theme_location' => 'footer-menu',
'menu_class' => 'footermenu'
));
?>
</nav>
<?php endif; ?>
</div>
</div>
</div>
</footer>
<?php wp_footer(); ?>
this is how I try to make some styling changes:
footer .footer {
background-color: #3a9dca;
}
.footermenu ul {
list-style-type: none;
}
I am new in wordpress developing, I try to edit my first blog, editing the menu was not painful, but the footer does not respect the css codes despite the stylesheet is the same.
Here is the code where I enqueue the css stylesheet file:
function load_stylesheets() {
/* loading my own stylesheet */
wp_register_style('style', get_template_directory_uri() . '/css/mainstyle.css', array(), false, 'all');
wp_enqueue_style('style');
}
add_action('wp_enqueue_scripts', 'load_stylesheets');
this is where I display my footer:
<footer class="footer">
<div class="container">
<div class="row">
<div class="footermenu col-md-4 col-xs-12 text-right">
<?php if (has_nav_menu('footer-menu')) : ?>
<nav><?php
wp_nav_menu(
array(
'theme_location' => 'footer-menu',
'menu_class' => 'footermenu'
));
?>
</nav>
<?php endif; ?>
</div>
</div>
</div>
</footer>
<?php wp_footer(); ?>
this is how I try to make some styling changes:
footer .footer {
background-color: #3a9dca;
}
.footermenu ul {
list-style-type: none;
}
Share
Improve this question
asked Mar 15, 2020 at 20:14
Hind DevHind Dev
1134 bronze badges
1 Answer
Reset to default 1It's just css misunderstanding. if you want to select elementname.classname
it means you are selecting elements by type of certain class like in fixed example below, but you've put a space between footer
and .footer
and this way rule expects markup like this
<footer> <div class="footer"></div> </footer>
This should work.
footer.footer {
background-color: #3a9dca;
}
footer .footermenu ul { /* i've added footer prefix here just for explicity - it was right before as well but it wasn't more specific as it is now */
list-style-type: none;
}