Tips for customizing the appearance of this div using Material UI's card/box components

Hey there! I am currently using a flexible div to house the h1 and arrow image (you can see it https://i.sstatic.net/OgVBp.png). I was wondering if there is a way to utilize a material UI component to give this "black box" a new look?

Here is the jsx code snippet for the "black box":

<div className={homeStyles.flex}>
      <span>
        <h1 className={homeStyles.landingText}>LISTEN TO ORCAS LIVE!</h1>{' '}
      </span>
      <span className={homeStyles.landingArrow}>
        <Image src={arrow} width="30px" height="30px" />
      </span>
    </div>

CSS:

.flex {
  z-index: 2;
  display: flex;
  flex-direction: row;
  background-color: #000000;
  position: relative;
  border-radius: 20px;
  max-width: 600px;
  margin:0px auto 0 auto;
  transform: translateY(-500%);
  align-items: center;
  justify-items: center;
  width: 40vw;
  height:5rem

}

.landingText {
  font-family: 'Mukta', sans-serif;
  font-style: normal;
  font-size: 44px;
  line-height: 100%;
  color: white;
  padding: 27px 10px 29px 33px;
  position: relative;
  
}

.landingArrow {
  position: relative;
  top: 35%;
  right: 2px;
  width: 30px;
  flex-shrink: 0;
  padding-right: 4px;
}

I'm looking to revamp it because the current design isn't responsive across different screen sizes. For instance, the text and arrow image are not aligned in the center or end of the box on smaller screens: https://i.sstatic.net/q3U1c.png

Answer №1

Here's a simple example for you to play around with. Feel free to customize it further to suit your needs! It's designed to be somewhat responsive, so give it a try on different devices.

This snippet utilizes Cards and Typography.

return (
    <Card style={{backgroundColor: '#0f0059', borderRadius:'10px'}}>
      <Typography variant="h3" style={{color: "#ffffff"}}>
        LISTEN TO ORCAS LIVE! &rarr;
      </Typography>
    </Card>
  );

Keep in mind that I used style={{}}, but Material UI suggests using sx as mentioned in their documentation.

If you have any further questions, feel free to ask in the comments section.

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

Troubleshooting HTML/CSS and JavaScript Issues with Dropdown Menus

I'm having trouble getting my dropdown menu to work properly and I can't figure out why. The JavaScript code should toggle a class that hides the language options and slides up the other tabs like "Contact". However, when I click the button, noth ...

Adjust the z-Index of the list item element

I am attempting to create an effect where, upon clicking an icon, its background (width and height) expands to 100% of the page. However, I am struggling with ensuring that the 'effect' goes underneath the this.element and above everything else. ...

Retrieving information using Graphql within a Gatsby-React component class

Check out this example of a class component in Gatsby-React that contains hard-coded data and functions properly: import React from "react"; class ExmpClassComp extends React.Component { constructor(props) { super(props); this.clickHandler = th ...

The lack of responsiveness in Bulma CSS is causing issues with the Bulma Carousel and image displays

I recently built a website using the Bulma CSS framework for styling, incorporating the Bulma Carousel for a text carousel. Utilizing Bulma's column feature, I positioned the carousel next to an image/video on the left side of the screen. Everything l ...

[php][html] stuck on trying to solve this error

Any help in figuring out the error on line 37 would be greatly appreciated. I've tried moving the ""; after echo and putting the entire PHP code in an img class="profilePic" src="http://i.imgur.com/ZICYW5z.png"/> and then using echo for the name (I ...

Disable browser autocomplete for Material-UI TextField

I am currently using Material UI version 0.20.0 and I am facing an issue where I need to prevent the password from being saved for a user in a TextField. I tried adding props to the TextField with autocomplete='nope' since not all browsers suppor ...

Creating double borders in CSS with the second border extending all the way to the top of the element

Can you help me figure out how to achieve this effect using CSS? It seems like a simple task: border-top: 1px solid #E2E2E2; border-left: 1px solid #E2E2E2; border-bottom: 1px solid #848484; border-right: 1px solid #848484; Just add: box-shadow: 0.7px ...

Encountering an error while trying to set up a React application

This is the exact error message npm encountered an EIO error with code EIO while trying to read from the registry for saxes package: i/o error, read You can find the complete log of this run in: C:\Users\kd_Prakash\AppData\Local\ ...

Chrome's display of HTML5 form validation bubble is not aligned correctly

Can anyone shed some light on why the Form Validation Bubble is showing up with a big offset in Google Chrome when trying to validate a form inside a jquery UI dialog? It seems to work fine when the javascript call creating the dialog is removed. Just want ...

Update the text content in the specific span element when the class attribute matches the selected option in the

How can I dynamically update text inside a span based on matching classes and attributes without hardcoding them all? An ideal solution would involve a JavaScript function that searches for matches between span classes and select field options, updating t ...

The overflow hidden property does not seem to be effective when used in conjunction with parallax

The issue arises when I attempt to use the overflow hidden property in combination with parallax scrolling. Although everything seems to be working correctly with JavaScript for parallax scrolling, setting the overflow to hidden does not contain the image ...

Adjust remaining vertical space

Trying to design a TailwindCss layout that resembles the following: +----------------------+ | | +-----+----------------+ | | | | | | | | | | | | +-----+------ ...

What is the best method for connecting my HTML to jQuery code?

Apologies for my lack of experience in coding, but I will try to keep this brief. To put it simply, when I insert my jQuery code directly into the HTML file below the content, it works perfectly - the element I want to animate 'hides' and then & ...

Fixing content at the bottom inside a container with Bootstrap 4

My app is contained within a <div class="container">. Inside this container, I have an editor and some buttons that I always want to be displayed at the bottom of the screen. Here's how it looks: <div class="container> // content here.. ...

React is choosing to re-render only one of the setState functions, neglecting the other

I'm currently in the process of developing a basic Tic Tac Toe game using React. The Objective: Each button in the game has its own state. When a button is clicked, it should change from ' ' to an 'X' and update the player's ...

Struggling to get the onHover effect working with the Grid item component in MaterialUI

I'm currently working on a Grid layout with nested Grid components, but I've run into an issue where applying inline styles to the Grid item component isn't working as expected. As a newcomer to MaterialUI in ReactJS, I could really use some ...

Looking to utilize Python Selenium for downloading a PDF file

I am currently working on automating the process of downloading PDFs using Selenium Webdriver in Python An issue I've encountered is that the download button is hidden within an embed tag in the HTML code <embed width="100%" height="100%" name="p ...

What exactly is the significance of localizing an Aria label?

Looking to add an aria label that needs to be localized. What exactly does this mean? Here is the code I have: <a href="link"><i class="button" aria-label="back button"> How do I modify this code in order to make ...

How to temporarily change CSS color for 5 seconds using JavaScript and incorporate an easing effect?

Regarding this query: JavaScript - Modifying CSS color for 5 seconds Here is a live example of the solution: http://jsfiddle.net/maniator/dG2ks/ I am interested in adding an easing effect to the transition, gradually making the color fully opaque and t ...

Rendering React on the server using Java Springboot

Looking to dive into server side rendering and wanting to implement React components on the server side, then pass them down in HTML. After following a tutorial on , I noticed that it is still rendering on the client side. I'm struggling to figure o ...