2

I am working on a React project and for designing I am using Ant design framework. What I trying to do is I have form in that I have four Input tags, I need to add some changes for third Input tag, What I want to do is for third Input tag I am trying to give margin-left. But I don't know how to do it so someone help me how to resolve this.

This is my code App.js

import React from "react";
import 'antd/dist/antd.css';
import { Row, Col, Button, Form, Card, Input, DatePicker } from 'antd';
import { SearchOutlined, StopOutlined } from '@ant-design/icons';
import "./App.css";


const App = () => {
  return (
    <div>
      <Row>
<Col className="main" span={18}>
          <div className="customizedCards">
            <Card>
              <Col className="main" span={7}>
                <div className="main-form">
                  <h5 className="idDetails">ID DETAILS</h5>
                  <Form>
                    <Form.Item>
                      <Input className="firstInput common" placeholder="Name" />
                    </Form.Item>
                    <Form.Item>
                      <Input className="secondInput common" placeholder="ID Number" />
                    </Form.Item>
                    <Form.Item>
                      <DatePicker className="date" placeholder="Expiration Date" format="YYYY-MM-DD HH:mm:ss" />
                    </Form.Item>
                    <Form.Item>
                      <Input className="fourthInput common" placeholder="Issue Date" />
                    </Form.Item>
                  </Form>
                </div>
              </Col>
            </Card>
          </div>
        </Col>
      </Row>
 </div>
  )
}

export default App

This is App.css

.idDetails {
  font-weight: bold;
}

.common {
  padding-top: 5px;
  padding-bottom: 10px;
  border-radius: 4px;
}

.date {
  padding-left: 121px;
  padding-top: 5px;
  padding-bottom: 10px;
  border-radius: 4px;
}


````
Vamsi
  • 372
  • 6
  • 18

3 Answers3

2

just delete your .date selector and use this selector if you need right align

.ant-picker-input > input {
  text-align: right;
}
Apostolos
  • 10,033
  • 5
  • 24
  • 39
1

This will be better if you want all of your placeholder same style.

::placeholder {
      color: #fff !important;
      opacity: 1 !important; /* Firefox */
    }
    
    :-ms-input-placeholder {
      /* Internet Explorer 10-11 */
      color: #fff !important;
      opacity: 1;
    }
    
    ::-ms-input-placeholder {
      /* Microsoft Edge */
      color: #fff !important;
    }

You can also modify the placeholder in ant design if you are using CRACO.

@input-placeholder-color: #fff;

some other ways: For this example I am using ant design Select. You can find the className to modify by inspecting the element.

.ant-select-selection-placeholder {
  color: #fff !important;
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
}
snufkin22
  • 139
  • 2
  • 5
0
.ant-select-selection-placeholder {
  color: red !important;
}

This one works for me!

Albert George
  • 321
  • 1
  • 3
  • 7