Position the second line of text to align in MUI

I am facing an issue with aligning the text on the second line. It should match up with the text on the first line.

For reference, you can check out the Codesandbox by CLICKING HERE

<Card sx={{ maxWidth: 200 }}>
  <CardMedia
    component="img"
    height="140"
    image="/static/images/cards/contemplative-reptile.jpg"
    alt="green iguana"
  />
  <CardContent>
    <Typography gutterBottom variant="h5" component="div">
      Lizard
    </Typography>
    <Box>
      <Typography variant="body2" color="error">
        &bull; Hello, how are you doing there?
      </Typography>
    </Box>
    <Box>
      <Typography variant="body2" color="error">
        &bull; Hi, how are you doing there?
      </Typography>
    </Box>
  </CardContent>
  <CardActions>
    <Button size="small"&rt;Share</Button>
    <Button size="small"><Learn More</Button>
  </CardActions>
</Card>

Answer №2

Have you tried incorporating the ul html element into your code and applying some custom styles?

...
      <CardContent>
        <ul>
          <li>
            <Typography variant="body2" color="error">
              How's everything going?
            </Typography>
          </li>
          <li>
            <Typography variant="body2" color="error">
              Hey there, how are things?
            </Typography>
          </li>
        </ul>
      </CardContent>
      ...

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 creating Material UI elements using React and Typescript

I am looking to extend a component from the Material UI library by creating a custom component that encapsulates specific styles, such as for a modal wrapper. However, I feel that my current solution involving the props interface may not be ideal. Is the ...

Understanding the concept of simple selectors and nested selectors in JSS can greatly enhance

Currently delving into ReactJS with material-ui and JSS, which is a new territory for me. I'm struggling to figure out how to select my H6 element or its children elements with the dangerStyle. Any suggestions? Thanks! myJss.js const myJss = them ...

Enhancing Backstage with Material-UI Theme Overrides using `withStyles`?

I am currently trying to customize the styling of a component in Material-UI that has been styled using withStyles. Upon inspecting the DOM, I noticed that the MuiSelect component within the Backstage application has had its styles overridden through CSS c ...

Error message: "Encountered a Jest TypeError - Unable to access properties of an undefined object (specifically 'html') within the new JSDOM

I have successfully set up a monorepo using Node.js and React. While trying to configure jest to run test suites, the API Node works fine but I encountered the following error on the client side: FAIL client/src/App.test.tsx ● Test suite failed to ru ...

Using ReactJS to display a collection of images

Currently diving into ReactJS and experimenting with the Spotify API, everything is running smoothly except for a hurdle I encountered while attempting to display an array of images retrieved from the API. I initially tried to render the images inside the ...

Tips for repositioning form fields using HTML, CSS, and Flask-WTF

I am currently developing my first web application. I require a basic form for users to input a few values. Although I have successfully implemented it, I would prefer the data entry fields to be arranged in a row instead of a column. The snippets below s ...

Using jQuery to set menu active states for a sprite-based navigation with distinct class names

I'm curious about how to accomplish this using JQuery. I have a menu where each item must have a unique class name in order for the CSS to properly display a sprite background position shared by all items. When an item is clicked, I also need to activ ...

Exploring the Differences Between Nth-CSS and Jquery

What are the advantages of using the nth function in CSS instead of applying it through jQuery, especially considering its compatibility with IE? Is it better to simply use jQuery from the start and avoid using it in a stylesheet altogether? Hopefully thi ...

Using the `map()` method in React's array

I stumbled upon an interesting example at http://codepen.io/lacker/pen/vXpAgj that closely resembles my current issue. Let's consider the following array: [ {category: 'Sporting Goods', price: '$49.99', stocked: true, name: &apo ...

Following an AJAX request, jQuery.each() does not have access to the newly loaded CSS selectors

Note: While I value the opinions of others, I don't believe this issue is a duplicate based on the provided link. I have searched for a solution but have not found one that addresses my specific problem. Objective: Load HTML content to an element u ...

Tips for increasing a variable by one with each button click?

I have a simple JavaScript function called plusOne() that is designed to increment a variable by 1 each time a button is clicked, and then display the updated value on a webpage. However, I'm encountering an issue where the addition only occurs once. ...

How can you apply an active class using React-Router?

My React-Router navigation issue nav.tsx import React from 'react' import { menu } from './menu' import { Link } from 'react-router-dom' import styles from './HamburgerMenu.module.scss' const HamburgerMenu: React.F ...

Attempting to modify the array content using useState, but unfortunately, it is not functioning as expected

Starting out with react.js and trying to update an array's content using useState upon clicking a send-button, but it's not working as expected. Struggling with adding date and number in the row. Check image here Here's what I'm aiming ...

Tips for including a for loop within a return statement in React Native

I'm having trouble displaying multiple content on the screen using a for loop. The map method doesn't seem to work for me because I don't have an array. Here's what I've attempted: {() => { for (let i = 0; i < cart ...

What is the process for creating a sub-menu for a dropdown menu item in Bootstrap 5?

https://i.sstatic.net/o4FLn.pngthis is my code which i have created this navigation bar with bootstrap and all of its drop downs but i want to add another drop down to the services drop down section inside of webdevelopment but it can't any easy solut ...

Tips for sending multiple Formdata in a single array to an express backend

How can I efficiently send multiple form data as an array to my express backend? When I try creating an array of formData, I end up receiving an empty object in Express. Even the payload in the network tab appears empty. let arr1 = {data: []} let data1 = ...

Which is more efficient for rendering performance: using images, CSS gradients, or box shadows with borders?

I'm curious about improving website scroll and animation performance. Which option would be better for your mobile webapp or website: Using a repeating thin image or CSS3 gradient? or Utilizing a repeating image instead of box shadow with a borde ...

dotdotdot.js is only functional once the window has been resized

For my website, I am attempting to add an ellipsis to multiline paragraphs that exceed a certain height. I have incorporated the dotdotdot jquery plugin from here. An odd issue arises when the page is refreshed, as the ellipsis does not appear until I res ...

Activate function when list item is clicked

My goal is to execute a function when users click on the li elements in the snippet below without relying solely on onclick. For instance, clicking on the first li element (with a value of 1) should trigger a function where the value "1" is passed as an ar ...

Struggle with the accordion collapse animation in Bootstrap4?

My implementation of accordion collapse in Bootstrap 4 is functional, but lacks smoothness. Can anyone offer suggestions on how to improve this? I have attempted to nest divs inside each other, but it has not yielded the desired outcome. Below is the code ...