Creating a visual list in a React JS component with images and text

Hey there, I'm new to react js and I'm looking to create a list with images and text using html, css, and bootstrap. The list should include song images and have options for download and liking them after the user clicks on three dots.

I've managed to display the image with text and a heart icon, but I'm struggling with how to open the options for like and download when the three dots are clicked. Can someone please help me with this?

When clicking on the three dots, I want to open this list https://i.sstatic.net/jqZ47.png

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">


</head>
<body>

<div class="container">
  <h2>Rounded Corners</h2>
  <p>The .rounded class adds rounded corners to an image:</p>
  <div class="row">
   <div class="col-md-2">
    <img src="cinqueterre.jpg" class="rounded img-fluid" alt="Cinque Terre" height="150px" width="150px">
   </div>
   <div class="col-md-4">
     <h5> Test test </h5>
     <p> test demo add here </p>
   </div>

   <div class="col-md-5 jusfity-content-end">
     <span> 12.35 PM</span>
     <span class="fa fa-icon"><i class="fa fa-heart-o" aria-hidden="true"></i>
 </span>
   <span class="fa fa-icon"><i class="fa fa-ellipsis-h" aria-hidden="true"></i>
 </span>

   </div>

  </div>

</div>

</body>
</html>

I tested the above code on the W3Schools site. Looking forward to your assistance!

Answer №1

Embrace Flexbox for all your layout needs!

I quickly put together something using a combination of display: flex, various justify-content, and align-items properties. Don't be afraid to experiment and try different options.

The images I inserted are just screenshots, not the prettiest. Consider adding some styling with border-radius and object-fit: contain for better results.

Check out the demo here!

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

Attempting to modify a JSON file within a React application

I recently obtained a JSON file named 'DealerList.json' which I managed to import into my app using the following code snippet: import DealerList from './json/DealerList' let tasks = DealerList; The tasks now store the JSON data and I ...

Establish the condition if the array is present

I am looking to conditionally set a state based on the existence of data retrieved from the server. const [names, setNames] = useState([...details?.names]) The details object is passed in as props and fetched from the database. The array details.names com ...

Using the spread operator to modify an array containing objects

I am facing a challenge with updating specific properties of an object within an array. I have an array of objects and I need to update only certain properties of a single object in that array. Here is the code snippet I tried: setRequiredFields(prevRequir ...

What could be causing the React.js axios data to display on the console but not on the screen?

I am currently working on a React Axios Project using data from . The characters data includes another API link, so I implemented an Axios loop to display the names of the characters. While I can see the characters' names in the console, they are not ...

Having trouble initiating a Next.js and Tailwind project using the npm run dev command

After creating a next - tailwind project using npx create-next-app -e with-tailwindcss my-project, I encountered an error while trying to run the app on Windows 7. When running npm run dev, I received the following error message: > @ dev E:\Coding ...

Numerous data inputs to manage with just a single submit button in redux-saga

I am facing an issue with handling multiple inputs and saving the data using a single button in my React component. Here is the method I have implemented: handleClick(e) { e.preventDefault(); this.props.newEmail ? this.props.onSaveNewEmail(this.p ...

Bulma: Tips for creating equally sized buttons?

I am working with Bulma CSS and trying to ensure that all my buttons are the same size. Currently, each button appears to have a different size based on the text content. I have looked into using the "is-fullwidth" option, but it makes the buttons too la ...

Display/Conceal JavaScript

I recently implemented a JavaScript function on my website to show/hide specific elements. However, being new to JavaScript, I have encountered some difficulties. I've spent quite some time troubleshooting the code but haven't been able to pinpoi ...

Tabbable bootstrap with dropdown functionality

I am currently in the process of integrating Bootstrap tabs and dropdown menus using version 2.3.4 <div class="container"> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container-fluid"> ...

Unable to override the .MuiInputLabel-root CSS class

Link to my latest attempt on Codepen: https://codesandbox.io/s/distracted-stallman-f0vmkb?file=/src/App.js I'm having trouble pinpointing the issue here, but I know there's something I'm missing. The class name override came from my refere ...

Facing challenges with integrating the stripe payment gateway within the strapi content management system

I recently developed an e-commerce website using Next.js, with Strapi as the CMS and Stripe for payment processing. Within the Strapi backend application, I integrated the API required for handling payments. Below is the code snippet: 'use strict&apos ...

Having trouble getting the group hover animation to function properly in Tailwind CSS

Just starting out with tailwind css and running into a little issue. The hover animation I'm trying to apply isn't working as expected in this case. Instead of seeing the desired animated background when hovering over the group, it seems the back ...

Button not triggering .hide() function as expected

Today, I've been attempting to implement a feature that involves making an image disappear when a button is clicked. Despite its simplicity, it doesn't seem to be functioning as expected. :/ Below is the HTML code snippet: <img id="project ...

What is the starting point of a Next.js application?

When deploying a nextjs app on c-panel hosting, it requires the entry point of the application which is typically set as app.js by default. In a regular React application, you have full control over this aspect, but with nextjs, it's not always clear ...

Is it advisable to move operations outside of the useEffect hook?

Is it advisable to move code outside of the useEffect function in React? function BuyTicket(props: any) { useEffect(() => { //.. }, [eventId, props.history]); // IS IT RECOMMENDED TO PUT CODE HERE? const userNameL ...

To trigger a state update using the useState hook and the onClick event, you need to double-click

I've noticed several inquiries on this topic, but the suggested solutions have not resolved my issue. The problem I am facing is that I must click twice to update the state of a constant defined using the useState hook. How can I ensure that it only ...

What could be causing certain grid items to display in a disorderly manner?

Currently, I am working on a CSS grid layout that resembles the one showcased in this demo. The challenge I'm facing is related to the ordering of items within the grid. Specifically, every 6th and 7th item seem to be out of order and I would like the ...

The implementation of Axios cancel token failed to function properly in a real-time search feature within a React application

I'm currently developing a dynamic search feature using React, where users can input search terms and receive JSON results. I attempted to implement axios cancel token for this functionality, but it doesn't seem to be working properly and I' ...

Is there a way to stop the Ionic/React fab button from following the movement of the keyboard?

In my App.tsx file, I have a fabulous button that sits on top of my bottom tab bar. It's not actually inside the tab bar because non-tab buttons tend to disappear if placed within IonTab. Currently, when I bring up the keyboard to type, the fab butto ...

Lexicaljs utilizes debounce to receive editor state JSON and text content in a React project

What I Need I am looking to retrieve the editor state in JSON format, along with the text content of the editor. Moreover, I prefer to receive these values in a debounced manner, as described here. The reason I want to obtain the values in a debounced wa ...