Separate the area into three parallel sections

My expectation was for the li elements inside the ul to be divided into 3 parallel lists of elements appearing next to each other. However, the list is showing up in a straight list.

I thought using col-xs-3 would solve the issue, but it doesn't seem to be working. Any suggestions on how to fix this?

return <div id="col_sub_1">
  <ul className="col-xs-3 sub-menu-width ">
  {
    childitem.map(function(subcat,subcatindex){
      {/*--LEAF WHEN NO CHILD ELEMENTS */}
      return  <li>
      {
        subcat.id !=54 ? <a className="event_menu_item_desktop"><span> {subcat.name}</span></a> : null
      </li>
    })
  }
  </ul>
</div>

Answer №1

Make sure to include the class col-xs-3 within the <li> tag, not the <ul> element. Additionally, ensure that all expressions are properly closed.

Remember to always assign a unique key to the top element inside a loop in React. You can try the following code:

return <div id="col_sub_1">
  <ul className="sub-menu-width">
  {
    childitem.map((subcat, subcatindex) => (
      <li key={subcat.id} className="col-xs-3">
      {subcat.id != 54 ? <a className="event_menu_item_desktop"><span> {subcat.name}</span></a> : null}
      </li>
    ))}
  </ul>
</div>

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

Tips for successfully sending a nested function to an HTML button and dropdown menu

I'm working on two main functions - getChart() and fetchData(). The goal is to retrieve chart data and x/y axes information from a database. Within the getChart function, I'd like to incorporate a dropdown menu for displaying different types of c ...

A comprehensive guide on how to find keywords within an array and then proceed to make all text within the parent div tag stand

I am currently looking for a webpage that displays a list of products based on keywords from an array. Once it detects any word in the array, it highlights it with a red background - everything is working smoothly so far. However, I now wish for the script ...

Different methods for modifying the height of an Angular datatable in response to the data provided

Encountering an issue with adjusting the height of a datatable when calling a webservice to populate it. A webpage features a collapsible div element alongside a datatable. Upon collapsing the div, the table's height is calculated and resized using i ...

Ways to stop Next JS 13 from automatically preloading pages

While using my app that is connected to Firebase, I have noticed that each time a page loads, my usage count exceeds due to the Next JS preloading feature. This unexpected increase in cost is concerning. How can I prevent Next JS 13 from preloading? I susp ...

`transpilePackages` in Next.js causing Webpack issue when used with Styled Components

I'm encountering an issue while utilizing components from a custom UI library in a repository. Both the repository and the web app share the same stack (React, Typescript, Styled Components) with Next.js being used for the web app. Upon running npm ru ...

"Troubleshooting problems with exporting ReactJS data to a CSV library

What steps can be taken to resolve this issue? [snowpack] Encountered an error while trying to load node_modules/react-csv/src/components/Link.js Unexpected token (110:6) in /home/clarkeustaquio/Documents/adec/adec/client/node_modules/react-csv/src/compon ...

Beginner in html, css, and javascript: "Tips for saving jsfiddle demos?"

Recently, I developed an interest in JavaScript and CSS and came across some impressive examples on jsfiddle. I was wondering if there is a way to "export" these examples to my computer. Simply copying and pasting doesn't seem to work. How can I modi ...

Safari causing placeholders to be sliced

I'm having trouble creating attractive placeholders in Safari. This is how it currently appears. Codepen: https://codepen.io/anon/pen/RLWrrK https://i.sstatic.net/aChBs.png .form-control { height: 45px; padding: 15px; font-size: 16px; col ...

Embrace the words enveloped within large quotation marks

I am seeking a way to format paragraphs with large quotation marks surrounding them. I have attempted several methods, but my line-height seems to be affected, as shown in the following image: Can anyone suggest a proper method for achieving this? (Addit ...

How to create dynamic transition effects in modal using AngularJS

My modal includes a next button for easy navigation. Initially, the modal showcases content within: <div ng-show="step1"></div> Upon clicking the next button, the modal transitions to display different contents in 'step2' within th ...

Transform your ordinary HTML select into a stylish span with this custom CSS class

I need help making a select element appear like a span under certain conditions. The CSS class I currently have works with input boxes, but not with dropdowns. Is there any advice on how to style the select element to look like a span without actually repl ...

Material-UI's JSS does not adhere to the justify content property

Having trouble aligning elements in my React app using material-ui 1.0 and its JSS solutions. The code I've written below should center justify, but it's not working no matter how I configure it. I suspect there might be a naming issue since mat ...

Having issues with NextJS create-next-app functionality

Having installed NextJS using both methods npm install next react react-dom and npx create-next-app appname several times, I expected the directories to be as follows: pages, api(_app.js, index.js), public, styles, .next, node_modules However, in MY proj ...

How do I create a notification when the div reaches 100% alignment on the left side using Javascript?

Is there a way to receive an alert when the div with the class name "earth" reaches 100% on the left side, without using jQuery? I attempted to utilize setTimeout but I am looking for an alternative method that does not rely on time, but rather on positi ...

Issues with jQueryUI sortable causing flickering and erratic movement while attempting to reorder and position items within the list

When using jQueryUI sortable with a long list of items, I encounter an issue where the items flicker and jump around the screen as I try to change their order by dragging them. This makes it nearly impossible to organize the items effectively. It seems li ...

What could be the reason for the callback not being triggered even after the prop has been

Currently, I am working on implementing a loader with asynchronous behavior. Here is the code snippet that I have: import { DonutChart } from './donut-chart'; const ParentComponent = () => { const [isLoading, setIsLoading] = useState(tru ...

The useState hook does not trigger a rerender when the update function is invoked within an onClick event handler

I have been searching for a solution for days without success. Whenever I use setPostState(myState.posts);, the component does not re-render. I am working with react ^16.10.2 Here is my code: import React, {useState, useCallback} from 'react'; ...

Encountering an issue when trying to submit a post request: "Received an API resolution without a response for /api/comments, which could lead to delayed requests."

Hey, I recently started diving into Next.js and I'm facing an issue with making a POST request to the API. In my project structure, I have a comments folder nested inside the api folder. Within the comments folder, I've written the following cod ...

What could be causing the Opera browser to send an excessive amount of "MessageEvent" messages through Nextjs in the console?

I have been a dedicated user of Firefox for programming my entire life, but recently I decided to give Opera a try due to its interesting features. However, I am becoming increasingly frustrated with the excessive spamming of the "MessageEvent" console. Is ...

"Why does the font on my website look different on my computer before I upload it to my web host? How can I fix

I am currently developing a website and have chosen the font "PT Sans Narrow" for it. Unfortunately, it seems that Chrome and many other browsers do not support this font by default. Is there a way to include the PT Sans Narrow font with the website when ...