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

I plan to compile a collection of names in a text field and then have the ability to select and access each name individually with just a click

I am currently working on a project that involves creating an admin site using Firebase. One of the main features of the site is large text fields that display information which can be modified. For instance, the user management page includes text fields ...

Oops! We encountered an issue where too many hooks were rendered compared to the

Hey everyone, I'm facing an issue when trying to connect 2 queries in my code. function MyApp(){ let companyId = fetchCompany(window.location.pathname); if(companyId !== undefined){ console.log(companyId); } let employees = fetchEmployees ...

Having trouble accessing properties of undefined when trying to read 'prepareStyles' in a ListItem component from Material UI within a React application

I have been struggling with an error for the past week, even though I have made sure that the rows is filled and defined before using. Can someone please help me understand why this error is occurring and how to solve it? Any assistance on resolving this ...

How can I implement conditional rendering with React on a div element?

Is it possible to implement conditional rendering by simply adding the boolean checked isVisible=true onto the div? Will this ensure that it only renders when true? Could there be any potential issues with the component's state changing after renderi ...

Get rid of the blue dots that appear on anchor tags

I am facing a strange issue with the anchors on my webpage. There are a few anchor tags in my body: <a href="link1.html"></a> <a href="link2.html"></a> <a href="link3.html"><img src="img1.png" /></a> Interestingl ...

Issue with CSS Reset code causing disruption for one hyperlink

Check out the menu at this link: http://fiddle.jshell.net/V88c6/8/show/ To view the complete jsfiddle, click here: http://jsfiddle.net/V88c6/8/ Here is the HTML code: <div id="head_1"> <div class="inner"> <div class="column ...

Scrollbar persists even after implementing the react-div-100vh solution

I've been experimenting with different ways to implement this, either in each component or in the main index.js file. Unfortunately, none of these methods have proven successful so far. import React from 'react'; import { render } from &apos ...

Is there a way to connect a CSS external file that is saved on Dropbox?

Is it possible to link an external CSS file stored in Dropbox with HTML? I have followed all the instructions I could find online, including clicking and pressing "Copy Dropbox Link" to generate an href link. However, it doesn't seem to be working. ...

Web page saving fails to preserve images!

Currently working on a PHP-based website that is utilizing the Zend framework and hosted on an Apache server. The folder structure within my www directory looks like this: +www | |_+css | | | |_images | |_js | |_images The issue I'm ...

What are some creative ways to incorporate MUI themes into non-MUI Components?

As an illustration, imagine if I have the need to dynamically apply a Material-UI theme to components that are not originally part of Material-UI, such as an <h1>. How can I establish a global rule in the theme for all <h1> tags to consistent ...

encountering the issue of not being able to assign a parameter of type 'string | undefined' to a parameter of type

Seeking help with the following issue: "Argument of type 'string | undefined' is not assignable to parameter of type" I am unsure how to resolve this error. Here is the section of code where it occurs: export interface IDropDown { l ...

Entering text into the input field with the string "Foo"<[email protected]> is not functioning correctly

The text in my input is initially filled with this string "foo foo"<<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4f2920200f29202061263b">[email protected]</a>>. However, after an insert, the string now l ...

I'm having trouble getting my website to align in the center of the

Struggling to center my website no matter what I try. I experimented with different CSS properties but haven't had much luck. margin: auto 0; I also attempted the following: margin-left: 50%; margin-right: 50%; The closest I got was aligning every ...

Manipulate the contents of children divs within a parent div using JavaScript or JQuery

<div id="abc"> <div id="a_b"> abcd </div> <div id="c_d"> xyz </div> </div> I have a challenge where the divs on my page are generated dynamically and their IDs change every time the page loads. When the window i ...

Creating a chic look for your conditional statement: If Else Styling

While it may not be possible to directly style PHP code, you can definitely style the HTML output that PHP generates. I'm curious if there's a way for me to apply styles to the output of an IF ELSE statement. if ($result != false) { print "Y ...

In Vue, when you want to display text after reaching a height of 50px, any additional text will automatically be replaced by five full

https://i.stack.imgur.com/mp0YJ.png >>>>>>>>>Explore Sandbox Example <div style="height:50px"> ...

Is it possible to remove the parent element using CSS?

Is there a method to remove the parent element while retaining the current element? Take a look at my example here: <div id="parent"> <div id="child"> <span>some text</span> </div> </div> div { ...

Tips on creating a transition in React to showcase fresh HTML content depending on the recent state changes

I am completely new to React and recently completed a project called Random Quote Machine. The main objective was to have a method triggered inside React when the user clicks a button, changing the state value and re-rendering to display a new quote on the ...

The art of applying styles through styled components

I am attempting to customize the styling of my component with the following code: export const StyledCascader = styled(Cascader)` background-color: gray; ul.ant-cascader-menu { background: red !important; } `; Despite using styled components ...

Conceal navigation options on smaller screens and enable drop-down menu functionality with Bootstrap 3

With the usage of Bootstrap 3, I have successfully hidden two menu items when the screen is resized. However, these items still appear in the drop down menu that appears on the top left (with three bars) when the screen size is reduced. Is there a way to k ...