我正在尝试将文本环绕在图像周围,如果我使用以下代码:
<div className="container">
<img src={myImageSource} alt="swimmer" height="300" width="300" style="float: left" />
<p> This is where the other text goes about the swimmer</p>
</div>
现在我知道这 style="float: left"
是html 5。但是,如果我使用以下代码:
<div className="container">
<img src={myImageSource} alt="swimmer" height="300" width="300" align="left" />
<p> This is where the other text goes about the swimmer</p>
</div>
有用!为什么我不能在 React 中使用样式?
原文由 AltBrian 发布,翻译遵循 CC BY-SA 4.0 许可协议
您仍然可以在反应中使用样式。试试:
style={{float: 'left'}}