How to customize an unordered list in a WordPress theme using Bootstrap 4

I am currently struggling with a frustrating problem where I cannot seem to style the ul list properly. I have tried various solutions, such as using # instead of . when targeting the "socials" class, but nothing seems to work.

Below is my code:

html:

<div class="header-information">
    <div class="socials">
    <?php
        $args = array(
            'theme_location' =>   'social-menu',
            'container'       =>        'nav',
            'container_class' => 'socials',
            'container_id' => 'socials',
            'link_before' => '<span class="sr-text">',
            'link_after'  => '</span>'
        );

        wp_nav_menu($args);
    ?>
    </div> <!--.socials-->
    <div class="address">
        <p>8000 Zürich, Teststrasse 12 </p>
        <p>Telefonnummer: +410 000 00 00 </p>
    </div>
</div><!--.header-information-->

css:

.socials.nav ul {
    list-style: none;
    text-align: center;
    padding: 0;
}

@media only screen and (min-width: 768px) {
    nav.socials ul {
        float: right;
    }
}

nav.socials ul li a:before {
    font-family: 'Font Awesome 5 Brands';
    display: inline-block;
    vertical-align: top;
    padding: 0 5px;
    content: '\f6af';
    font-size: 30px;
}

Answer №1

If your website's menu structure looks like this,

<div class="header-information">
  <div class="socials">
  <nav>
    <ul>
      <li>One</li>
      <li>Two</li>
      <li>Three</li>
      <li>Four</li>
      <li>Five</li>
    </ul>
  </nav>
</div>

Then there may be an issue with your CSS selector.

Specifically, this line of code,

.socials.nav ul{

Should actually be corrected to look like this,

.socials nav ul {

as nav is not a class, but an element in the HTML markup.

I hope this clarification helps. Cheers!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The image tag disrupting the spacing between lines

Here's a snippet of the css and html code: CSS: div { height:24px; line-height:24px; } HTML: <div><img src="image.png"/>Text</div> According to the code, a div should be 24 pixels high with text vertically centered after ...

What is the best way to change a vertical drop-down menu to a horizontal layout?

I need help aligning my dropdown menu horizontally instead of vertically. I tried using the flexbox example from w3 schools, but it didn't work when I included the classes inside my select tag. Even after debugging, I realized that the issue is with t ...

I am encountering issues with an HTML table that is in need of fixing, and I must find a solution without relying on

Can someone help me troubleshoot the structure of this table in the given image? It seems like my rowspan and colspan attributes are not working as expected. I've only used CSS to specify the width and height of the cells. https://i.sstatic.net/VtHbH ...

I am facing difficulties displaying the egin{cases}…end{cases} equation using Jekyll's MathJax

MathJax is used on our course website. We have implemented MathJax in Jekyll and hosted it on GitHub pages. While MathJax works well for simple equations, I have faced difficulties with more complex ones. Despite spending hours investigating and experiment ...

Manipulate HTML Table to Obtain Value of First Column Cell When Another Cell is Clicked using Javascript

I have a PHP web application where I am retrieving data from MySql and displaying it in the HTML table below. <table id = "table" width="500px" cellpadding=2 celspacing=5 border=2 > <tr> <th>Subject Code</th> <th>Subje ...

The hamburger icon on the Bootstrap 4 navbar expands as expected, yet it fails to collapse back when

<head> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src=" ...

Generating HTML documents programmatically with Java

Seeking advice on creating an HTMLDocument object programmatically in Java without the use of external string generation and parsing with HTMLEditorKit#read. My main concerns are speed and code cleanliness, as I believe directly constructing the internal ...

What is the reason the <line> tag is not functioning properly when used within the <clipPath> element?

Here's an example using: <circle> <svg viewBox="-20 -20 150 150" xmlns="http://www.w3.org/2000/svg"> <clipPath id="myClip" clipPathUnits="objectBoundingBox"> <circle cx=".5" cy=".5" r=".5" /> </clipPath> < ...

Is it possible to trigger an A-Frame DOM/CSS/animation event based on video timestamps?

Is it possible to activate an event in A-Frame based on a specific time point of a video or audio file, without the need to interact with the video object directly? For example, changing the light or color properties of a nearby primitive? I am currently ...

Change the background color on hover without affecting the text color

I am having some trouble with my code. I can only change the color of the "popup1_btn" button when hovering, but the text color remains the same. If I use .popup1_btn a:hover, it only changes the background and text color of the text, not the entire button ...

There are two notable problems with Bootstrap 4 Tooltip. The first is that it appears when a button is clicked, and the second is that it shows up for disabled elements

I am currently experiencing an issue with my tooltip while using Bootstrap 4. In my index.html, I have the following script loaded: $('body').tooltip({ selector: '[data-toggle="tooltip"]', delay: { show: 550, hide: 0 } }); The proble ...

Grab a parameter from the URL and insert it into an element before smoothly scrolling down to that

On a button, I have a URL that looks like this: www.mywebsite.com/infopage?scrollTo=section-header&#tab3 After clicking the button, it takes me to the URL above and opens up the tab labeled tab3, just as expected. However, I would like it to direct m ...

Why is my Bootstrap row exceeding the page width when I resize it?

As a newcomer to Bootstrap, I have been following tutorials to learn more about it. Currently, I am attempting to recreate the layout of Google's homepage. However, I am facing challenges with the grid system's responsiveness. I have managed to ...

What is the best way to insert an HTML element without disrupting the layout of the current content?

Consider a scenario where you have a simple webpage with the following content: <h3>Hi!</h3> <img src="http://www.thehindu.com/multimedia/dynamic/01338/IN__GOOGLE__1338298f.jpg"> If you were to add a link like this: <a href="#">m ...

Dynamic tables that reorganize when viewed on different devices

While working on a responsive website with Magento v1.8, I encountered a challenge in making the header responsive. I attempted using div but couldn't get it to work as expected. Switching to the table method has brought me halfway there, but I'm ...

Steps for sending data to a modal window

Consider this scenario: I have a function that retrieves some ids, and I utilize the following code to delete the corresponding posts: onClick={() => { Delete(idvalue[i]) }} Nevertheless, I am in need of a modal confirmation before proceeding with the ...

Issues with retrieving data from Firestore and storing it into an array in a React

Struggling to fetch data from my firestore and display it on the webpage. Despite trying all possible solutions and searching extensively, I am unable to get it working. When using the code below, nothing appears on the website. However, if I switch to th ...

I am attempting to modify the class of a text field and display a feedback message when the input length falls between 1 and 20 characters, but I am unable to determine the cause of the issue preventing it from

In this code snippet, I am utilizing Bootstrap classes to change the design of an input field based on its length validity. Additionally, a feedback message is displayed accordingly. However, upon running the function, the input field does not reflect the ...

Unnesting Django Endless Pagination in a Twitter-style format, how can I move a div outside of another div?

After implementing Django Endless Pagination with the Twitter Style and Show More option, everything seems to be working smoothly without any issues. I've even included media queries in the HTML render to help visualize the problem more clearly when r ...

Guide to adding dividing lines between columns with bootstrap

https://i.sstatic.net/FHO1v.pngCan someone help me with adding separators between columns in my HTML code? I've tried the code below but it's not working. Is there a way to achieve this? I've attached a screenshot of what I'm expecting. ...