Reputation: 6077
I'm using Antd for a ReactJs
project, but I saw that there is an erroneous rendering in the components layout.
Here is my code
import React from 'react';
export default class Test extends React.Component {
render() {
return (
<div style={styles.test}>
<p>This is a text</p>
<img style={styles.image}
src={require('../../assets/images/test.png')}
/>
</div>
)
}
}
var styles = {
test: {
display: "flex",
justifyContent: 'center',
alignItems: 'center',
backgroundColor:'#334455'
},
}
Which results in this rendering
As you can see they are not aligned horizontally.
But if I comment this line inside my App.js
// import 'antd/dist/antd.css';
Then everything renders perfectly
Why is this happening? Am I doing something wrong?
Upvotes: 0
Views: 101
Reputation: 2081
your ntd/dist/antd.css
file may have some css(i.e. for image OR p or div tag) which affects the layout of your elements
Upvotes: 1