Applying FAB (Material UI) to span across 2 columns in a CSS Grid: A step-by-step guide

Is there a way to make the zero button larger than the other buttons in its row by spanning 2 columns? I would like it to be an oversized oval shape. Appreciate any assistance you can provide.

import "./styles.css";
import Button from '@mui/material/Button';
import Fab from '@mui/material/Fab';

export default function App() {
  
  return (
    <div className="App">
      <div className = "blank"> </div>
      <div className = "btn-container-div"> 
      <div className = "screen-div"> </div>
      
      <div className = "row"> 
      <Fab> AC </Fab>
      <Fab> +/- </Fab>
      <Fab> &#37; </Fab>
      <Fab> &#247; </Fab>
      </div>
      <div className = "row"> 
      <Fab> 7 </Fab>
      <Fab> 8 </Fab>
      <Fab> 9 </Fab>
      <Fab> &#215; </Fab>
      </div>
      <div className = "row"> 
      <Fab> 4 </Fab>
      <Fab> 5 </Fab>
      <Fab> 6 </Fab>
      <Fab> &#247; </Fab>
      </div>
      <div className = "row"> 
      <Fab> AC </Fab>
      <Fab> +/- </Fab>
      <Fab> % </Fab>
      <Fab> &#8722; </Fab>
      </div>
      <div className = "row"> 
      <Fab> 0 </Fab>
      <Fab> . </Fab>
      <Fab> &#61; </Fab>
      </div>

      </div>
      
    </div>
  );
}
.App {
  display: grid;
  background:black;
  height: 150vh;
  width: 100vh;
  margin: auto;
  grid-template-rows: 2fr 10fr;
}

.blank {
  background: red;
}

.btn-container-div {
  background: blue;
  display: grid;
  grid-template-rows: repeat(6,1fr);
  
}

.screen-div {
  background: white;
}

.row{
  background: black;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  justify-items: center;
}

Is there a way to make the zero button larger than the other buttons in its row by spanning 2 columns? I would like it to be an oversized oval shape. Appreciate any assistance you can provide.

Answer №1

The issue has been resolved. I included a new className for the fab element and applied grid-column: span 2 in the CSS.

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

Equal height elements - Bootstrap

Is there a way to make all elements in a list the same height, even if one element has more text than the others? I've been using divs for this purpose, but I'm open to switching to li items. Any advice on the best approach? I'm currently w ...

Modifying the state object in ReactJS: A step-by-step guide on updating values

Below my query and explanation, you will find all the code. I am currently attempting to update the state in a grandparent class. This is necessary due to file-related reasons, and I am using Material-UI for text boxes. Additionally, I am implementing Red ...

Confusing NPM peer dependency situation in the absence of any actual conflict

When I run npm install, I encounter the following error: npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62110b160722524c534c52">[ ...

Alert: The `ref` input is not recognized as a prop. Attempting to access it will only return `undefined`

When attempting to use React, I encountered a warning message that only appeared when clicking the button for the first time. After consulting chatGPT, it assured me that my code was correct and should not be generating these warnings. // App.js import MyR ...

Running the command `$ yarn install` results in an error message saying "yarn-berry.js

I'm a newcomer to React and I'm encountering an issue with the yarn install command that is producing the following error message: Error: Cannot find module '/Users/MacPro/Desktop/Developer/React/.yarn/releases/yarn-berry.js' at Funct ...

What methods are available to test my website across different browsers such as outdated versions of Internet Explorer like IE8?

Currently, I am working on Chrome with Windows 7 OS installed. However, Windows 7 does not support Internet Explorer 8. This is causing issues when trying to view my web pages in the IE8 version and older. How can I resolve this problem? I have attempted ...

Having difficulty creating a TypeScript function

I've encountered a TypeScript error that has left me puzzled: src/helpers.ts:11:14 - error TS2322: There's an issue with this piece of code and I can't quite grasp it: Type '<T extends "horizontal" | "vertical" | undefined, U extends ...

The display:block-inline feature seems to be malfunctioning

Even though I've specified the width of columns as 25%, the boxes are still not aligning in a single line: ...

Using jQuery to create a dynamic fullscreen background image that responds to mouse movement

I am currently working on creating a dynamic full screen background that responds to the movement of the mouse. The idea is that as you move the mouse around, the background image will shift accordingly. For instance, if you were to move the mouse to the ...

Ways to modify font color in JavaScript "type"

Recently, I came across a fascinating technique where by simply refreshing the page, the text changes sentences. I managed to implement the code successfully, however, I am having trouble changing the color, size, and alignment of the text. <script type ...

Looking for the perfect CSS layout for Angular 5 Material UI?

While exploring the Material UI for Angular 5, I noticed a lack of layout-related CSS compared to the previous version Material UI for Angular v1.x. Is there a workaround to achieve similar layouts within this framework, or would it be necessary to utili ...

How can you make an IonPopover dynamically appear from a button with the perfect positioning?

I want to display a popover below a button when the button is clicked, similar to the example on the Ion docs page. However, I am having trouble implementing this in React as the code provided is only for Angular. Here is my current code: ... <IonButt ...

React.js Form Validation issue: When using input type "number", the text field remains a single value even after attempting to delete characters with the backspace key

Experiencing difficulty in clearing the input field value, even after pressing backspace the value remains constant. One particular value persists in the input field. import * as React from "react"; import { Button, Form } from "react-boots ...

The React form data was sent to the Express backend, but upon receipt, it was

Currently, I am working on image uploading in my MERN app. I am utilizing the express-fileupload package for this purpose. The issue I am facing is that while sending an image from the frontend in FormData, the backend is receiving null values. Frontend c ...

The term "Movie" is not compatible as a JSX component

Currently working on a movie app project but encountering issues with handling arguments and displaying them properly using TypeScript. The challenge lies in trying to map the movie object, display them individually on the homepage, and showcase all the re ...

Scaling Vuetify icons dimensions

During the development of an app using Vuetify, I encountered challenges in changing the default colors set by Vuetify. After some trial and error, I came across a solution on: https://github.com/vuetifyjs/vuetify/issues/299 The solution involved adding ...

Struggling to determine what comes after

I've been seeing discussions about ThemeManager scattered around the internet, but it appears to be only accessible in the react-native branch. Is this absence from the "next" release intentional or unintentional? Thanks, Andy ...

CSS - Revealing an element on the backface post flip animation

I encountered an issue while working on a CSS flip card project. Despite using backface-visibility: hidden;, one element remains visible from the other side. In the simplified snippet provided, if you click on more in the bottom right corner, the card fli ...

Displaying image issues persist on Safari browsers for Mac and iPhone

I am currently working on a website and facing an issue with the responsive image display on Safari for Mac/iPhone. Here is the code snippet I have been using: <head> <meta charset="utf-8"> <meta http-equiv="Content-Language" co ...

Caution from React: Property x does not match. Server value: x, Client value: x

While working with the Next.js framework in React, I encountered an error related to the react-avatar-editor package. The specific issue seems to be: Warning: Prop `width` did not match. Server: "250" Client: "500" in canvas (created by ...