0

I am using Ant Design to create a row contains two columns, I want the content in a column to be right aligned.

My code:

        <Row gutter={[0, 8]}>
            <Col span={15}>
                {currentProject.tags &&
                        currentProject.tags.map((tag, index) => (
                            <Tag key={index}>
                                {tag}
                            </Tag>
                        ))}
            </Col>
            <Col span={9}></Col>
        </Row>

I want the content inside the column with span={15} to be right aligned. I tried style={{justifySelf: 'right'}} , style={{justifyContent: 'right'}}, style={{justifyItems: 'right'}} they are all failed.

Does any one how to use the right CSS to align the content right?

JavaScript Rookie
  • 153
  • 1
  • 3
  • 10

1 Answers1

3

Please add display: 'flex', justifyContent: 'flex-end' to your Col:

 <Row gutter={[0, 8]}>
        <Col span={15} style={{display: 'flex', justifyContent: 'flex-end'}}>
            {currentProject.tags &&
                    currentProject.tags.map((tag, index) => (
                        <Tag key={index}>
                            {tag}
                        </Tag>
                    ))}
        </Col>
        <Col span={9}></Col>
    </Row>

You can check it here

gikall
  • 559
  • 5
  • 16