Mastering the Art of Customizing Styling in Ant Design

I'm currently working with a table from Ant Design, but I'm facing an issue where the padding or margin applied by the Ant Design CSS is preventing the table from expanding on the left side. The table has an inline CSS of table layout: auto which I cannot seem to remove. I've tried using CSS Meyer's reset and adding margin: 0 !important to various elements, but the padding just won't go away. Below is some code for reference. Any help would be appreciated. Thank you.

    background-size: cover; 
    background-repeat: no-repeat;
    height:180vh;
    margin-top:4%;

}

.wine-heading{
    font-size:4rem;
    text-align:center;
    font-family:Italianno;
    color:#f0ead6;
    

}

.ant-table-cell{
    font-size:1.5rem;
    font-family:Italiano;
    text-align:center;
    color:white;
    text-align: center;
    margin-left:auto;
    margin-right: auto;
    
}

.ant-table-thead .ant-table-cell {
    color:beige;
    text-shadow:0px 1px 1px black;
    display:flex column;
    justify-content:space-between;


}

table{
    margin:0 !important;
    display:flex column;
    justify-content:space-around !important;
}


.ant-table-content table{
    margin:0 !important;
}




.ant-table-container{
    margin:0;
    width:100%;
}

.ant-table-tbody{
    display:flex column;
    justify-content:space-around;
    
}

.ant-table-tbody{
    padding: 0 !important;
  }
  .ant-table-tbody  > tr > td{
    padding: 0 !important;
  }

.ant-table{
    margin:0 !important;
}

winelist.js
return (
    <>
      <section
        className="wine-section"
        style={{
          backgroundImage: `url(${wine})`,
        }}
      >
        <animated.div style={props}>
          <h4 className="wine-heading">Carmellos Wine List</h4>

          <Table dataSource={dataSource} columns={columns} pagination={false} />
        </animated.div>
      </section>
    </>
  );

Answer №1

Are you trying to customize the CSS in an antd table? I had a similar problem a few days ago. You can import a winelist.css file: Inspect the HTML elements in Chrome and find the CSS selector, then override the styles as neededhttps://i.stack.imgur.com/uAJJx.png

[![Click here for image description] https://i.stack.imgur.com/DyFYc.png

You can experiment with overriding styles here, focusing on padding within the <a> tag.

Answer №2

When using a developer tool, locate the specific table div that contains padding or margin.

To override this in your project's global CSS file, add padding and margin of 0 with !important to the same class. This should resolve the issue.

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

Looking for CSS templates for improving your business web apps?

Many CSS templates out there are fixed-width, typically around 900 pixels wide... Right now, I'm in the process of creating an intranet Rails application and I'm seeking a good resource for CSS templates designed specifically for business applic ...

What could be causing the 404 error message in Backend deployment on Vercel?

Hello everyone, I'm currently in the process of deploying the backend for my MERN application on Vercel. Prior to this attempt, I successfully deployed a small todo project using MERN on Vercel. Everything worked fine then, and I followed the same st ...

stuck with an outdated dependency causing issues with create-react-app

Encountering a problem with create-react-app failing due to react-scripts expecting an older version of a dependency, making it difficult to select the new version as suggested. This appears to be an interface issue. Interestingly, I can successfully inst ...

Troubleshooting problem with displaying HTML content on Internet Explorer 10

My website was developed using jquery with a dynamic coding style. It was functioning properly in IE10 while working from Visual Studio. However, after deploying it to the production server, the entire style seemed broken in IE10. In all other versions o ...

As I resize my browser window, I notice that my menu button starts to shift upwards along the

I recently created a menu button that looks great, but I noticed that when I shrink the browser window, it starts to move slightly upwards. It's really annoying and I can't figure out why this is happening. Can someone please help me troubleshoot ...

Achieve a new line break when the user hits the "Enter" key using HTML and JavaScript

I'm in the process of developing a Chrome Extension that allows users to create a to-do list. My goal is to enable users to submit their task by pressing the "Enter" key, which should move the task to the next line after submission. I am currently fac ...

How can I organize the images into a structured format that allows me to easily access them as needed?

One thing that would make my life easier is if I could centralize all the images in an 'Image.jsx' file in React and easily access them from other files. For instance export const Header = ({ title, children }) => { return ( <> ...

Set the height of the unordered list (ul) to be

I came across a design on Facebook that resembles a timeline, but I am having trouble adjusting the height of the ul element. <ul class="timeline">...</ul> I want the line in the middle to fill the height of the page even when there is less c ...

Dynamic Page Title Updates

Is there a method, program, or technique available to alter the title of a webpage based on the first "heading" tag that is found? For example: Since these tags often resemble each other, it may be beneficial to incorporate this as a default parameter. ...

reasons for utilizing `this.initialState = this.state;`

Could someone help me understand why I am using this.initialState in a React JS class component setup? class Registration extends Component { constructor(props) { super(props); this.state = { username: '', email: '&apo ...

Creating a circular frame for your image to use as a Facebook profile picture

In the process of developing an input feature that allows users to upload file images for avatar changes, similar to Facebook's functionality. However, I am aware that Facebook utilizes a circular area for avatars and enables users to adjust the image ...

A step-by-step guide on troubleshooting and resolving issues during the installation of chakra-ui and a react app

Seeking help to overcome installation errors related to Chakra-UI and React app **user@user:~/Desktop/Projects$ npx create-react-app my-app --template @chakra-ui** [Error][1] Creating a new React app in /home/user/Desktop/Projects/my-app. ... (similar co ...

The HTML div is not aligned in the center even when using flexbox

After creating a list within a centered flex div, it seems that the list is not aligning properly. I used flex on the list-div2 and the translate rule in the parent's middle-text div, but it still doesn't look centered as expected. Can anyone p ...

Issue: Incompatibility between React and TypeScript leading to an error message - "No

When I try to map through an array in my code, I encounter a significant error as shown below: // Home.tsx render() { const { inputs, outputs, expectedOutputs } = this.state; return ( <ContentContainer> {inputs.map((inpu ...

What are the steps to navigate to History in React Router v4?

With the current version of React Router (v3), I can handle a server response by using browserHistory.push to navigate to the appropriate page. However, this functionality is no longer available in v4, and I'm unsure of the correct approach to achieve ...

Modify the default background color for the chosen element in the tree structure

Could someone assist me in changing the default background color of a selected element in the tree? Below is the XHTML code: <style type="text/css"> .ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state- ...

align the horizontal navigation bar

I am facing an issue with my horizontal navigation bar. I want to include a search bar within the navigation bar, but it is causing misalignment. Here is the link to the code: https://jsfiddle.net/r6ntxg2f/ If you look at the menu, you will notice that i ...

I'm encountering a Typescript error where I'm unable to assign a function to RefObject.current and it's indicating that the function is not callable

Does anyone know why assigning a function type to a ref.current type is causing me issues? useEffect(() => { savedHandler.current = handler; // ERROR HERE: }, [handler]); TS2741: Property 'current' is missing in type '(e: Chang ...

Avoiding external variable reference through Jest.mock

For snapshot testing, I need to create a simple dummy mock of 1 react component. When attempting to use React.Component within the mock function, an error is thrown: The second argument of jest.mock() cannot reference external variables. However, usin ...

I'm attempting to build a React app using the command (create-react-app app-name), however, I keep encountering an error. Can anyone shed some light on why this

Despite trying to clear the cache, my problem persists. It was functioning properly just a few hours ago, until I used npm run eject on another project. Since then, I have been encountering this error. I will include an error file along with the log. Can a ...