我有一个div,其中显示一些带有换行符的文本。
<div className={this.props.theme.container}>
<div className={this.props.theme.unsupportedMessage}>
Device must be connected over USB
Or
to the WiFi
</div>
<USBImage className={this.props.theme.usb}>
</div>
css:
.unsupportedMessage {
white-space: pre-line;
text-align: center;
}
.usb {
height :100px;
width:100px;
}
.container {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
}
我必须在“必须通过USB连接设备”行之后显示图像。我尝试了绝对定位,但没有运气。
您能尝试这个吗:
<div className={this.props.theme.container}>
<div className={this.props.theme.unsupportedMessage} style={{display: "inline"}}>
Device must be connected over USB Or to the WiFi
</div>
<USBImage className={this.props.theme.usb} style={{display: "inline"}}>
</div>
在这里,我只是添加属性:display:inline。
希望对您有帮助。