React-Bootsrap Col with additional right margin

https://i.sstatic.net/FTfyi.png

I'm facing a challenge with positioning corner components on the screen using react and react-bootstrap. Even after trying various methods like modifying col size, adjusting right positioning, and using box-sizing property, I'm still unable to eliminate extra space added by the Col wrapping the SVG component on the right side. This issue prevents me from placing the components in the respective corners effectively. Below is the code snippet for the parent component and the corner component.

return (
    <div>
      {error && <Alert variant="danger">{error}</Alert>}
      {searchParams.get("user") != null &&
        <svg onClick={redirectAccount} width="60px" height="60px" style={{ position: "fixed", right : "48%", padding : "10px"}} viewBox="0 0 24.00 24.00" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#000000" stroke-width="0.00024000000000000003">
          <g id="SVGRepo_bgCarrier" stroke-width="0"/>
          <g id="SVGRepo_iconCarrier"> <g id="style=doutone"> <g id="add-box"> <path id="vector (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M1.25 8C1.25 4.27208 4.27208 1.25 8 1.25H16C19.7279 1.25 22.75 4.27208 22.75 8V16C22.75 19.7279...
    </div>

And here's the code for the corner component:

import { ReactComponent as CornerImg } from '../img/corner.svg';


export default function Corner(props) {

  const style = {
    transform: "rotate(" + props.rotation + "deg)",
    width: "70%",
    height: "auto",
  };

  return (
    <CornerImg style={style} />
  );

}

Answer №1

Include the property position: absolute;.

Make the following modification...

<Col xs={2} lg={3} style={{padding : 0, right: 0, position: "fixed", bottom: 0, blockSize: "fit-content"}}>
  <Corner rotation="180" />
</Col>

...transform it to this.

<Col xs={2} lg={3} style={{padding : 0, right: 0, position: "absolute", bottom: 0, blockSize: "fit-content"}}>
  <Corner rotation="180" />
</Col>

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

How can I adjust the widths of two input fields in a jQuery select box?

I found this cool jquery plugin that enhances the appearance of select dropdown boxes. You can check it out here: http://code.google.com/p/select-box/ Take a look at this fiddle to see how it works: http://jsfiddle.net/FQKax/1/ I've been trying to m ...

I'm unsure about the JavaScript toolkit framework's handling of selecting HTML class attributes

I have been exploring the Electron Framework using a JavaScript toolkit known as Xel. In my main.js file, I am working with the following syntax: document.querySelector("menu.selected").className.remove('selected') In my Xel code snippet, I hav ...

Is there a way to display the output of jQuery in an input box rather than a span?

I need to display the result of this function in an input box instead of a span tag because I plan to utilize the result in the following form. function checkChange(){ $.ajax({ url: "ordercalculate.php", data: $('form').seria ...

What could be the reason for Sequelize to completely replace the record when updating in a put request?

I've been attempting to implement an "edit" feature within my project, but I've hit a roadblock in the process. Here's a snippet of the put request code: export const updateEvent = (event, id) => (dispatch, getState) => { request ...

Python Selenium tutorial: Navigating inner scrollbars on websites

Struggling to implement scrolling within a container with its own scrollbar. Various methods have been attempted, but none have succeeded or met the desired standard. Here is the HTML code snippet of the scrollbar: <div id="mCSB_2_dragger_vertical ...

Choosing a color while hovering over the navigation bar

I'm trying to modify the color of my navigation bar when hovering over it with the mouse. Currently, it's black but I want it to change to a light grey or white color. What am I missing here? HTML: <!DOCTYPE html> <html> <head ...

Challenge with Overriding Material-UI Themes

One of the challenges I faced was overriding the <ExpansionPanelSummary/> component in Material UI to reduce margin. To achieve this, I utilized a theme with overrides. const theme = createMuiTheme({ overrides: { MuiExpansionPanelSummary: { ...

Footer not sticking to the bottom of the page with Material UI

View Page Screenshot My challenge is with the Footer using AppBar when there is no content. It doesn't properly go to the end of the page, only to the end of the content. I want it to stick to the bottom of the page if the content doesn't reach ...

Access Firestore documents within the NextJS 13 framework

As a newcomer to React/NextJS, I am working on fetching a list of documents from a Firestore Collection using NextJS 13 in a SSR Page so that I can display them below. Although I have successfully retrieved the documents within my function, the challenge ...

What is the process of implementing a particular FormControl from a FormArray in my HTML file?

My FormArray initialization code is as follows: this.contents.forEach(content=> { this.formArray.push( new FormControl(content.text, Validators.required)); }); Now, I am trying to associate a specific FormControl with my textarea by using i ...

Achieving a full-width image display in Bootstrap: A guide

I've been struggling to find a solution to stretch an image across a div using CSS and Bootstrap. I attempted to make both the div and parent container fluid, but no matter what I try, there always seems to be some white space on the left and right si ...

Searching for a specific text within an element using XPATH in C# with the Selenium framework

My current challenge involves locating specific text within certain elements on an HTML page. <a class="ProductCard-link ProductCard-content" target="_self" tabindex="0" href="/en/product/puma-future-rider-menshoes/314 ...

Create a function within components and then invoke it

Just a quick question - where's the best place to define a function in React so that it can be called from any component? For example, I have a function that scrolls the page to the top whenever a specific component is mounted. Right now, I've c ...

Which is the better approach for performance: querying on parent selectors or appending selectors to all children?

I currently have 2 mirror sections within my DOM, one for delivery and another for pickup. Both of these sections contain identical content structures. Here's an example: <div class="main-section"> <div class="description-content"> ...

Design a modern slider with a button that triggers a pop-up modal window

Recently Updated I am working on a testimonial slider using slick slider, and I want to incorporate a modal within each slide. In my custom post type 'Testimonials' (also known as 'getuigenissen' in English), I have various Advanced C ...

What is the best way to extract content between <span> and the following <p> tag?

I am currently working on scraping information from a webpage using Selenium. I am looking to extract the id value (text) from the <span id='text'> tag, as well as extract the <p> element within the same div. This is what my attempt ...

Header and footer that stick in place while content scrolls automatically

To create a layout where the header and footer remain sticky while the content has a minimum height and shows a scrollbar when the viewport is too small, I found success with this codepen: http://codepen.io/DlafCreative/pen/wzdOEN inspired by another sourc ...

The problem of Twitter Bootstrap 2 top navigation dropdown not functioning properly on mobile devices

I’ve spent a significant amount of time researching the issue prior to reaching out here, but unfortunately I haven’t been able to find a solution yet. Website Link: Currently, I am using Twitter Bootstrap 2.3.2 and have integrated a form in the drop ...

Unable to switch checkbox state is not working in Material UI React

I am experiencing an issue with the Material UI checkbox component. Although I am able to toggle the state onCheck in the console, the check mark does not actually toggle in the UI. What could be causing this discrepancy? class CheckboxInteractivity exten ...