【问题标题】:react js data is always display colmn wisereact js数据总是按列显示
【发布时间】:2021-01-31 17:24:03
【问题描述】:

嗨,伙计们,我在一个小错误中卡住了 react js,当我尝试显示简单的 hello world 程序时,它会按列显示,但我希望按行显示,请告诉我该怎么办?

这是我的输出 https://ibb.co/3CN6zxM

import React from 'react';
// import '../Components/SidebarR.css';

const Sidebar = () => {
    return (
        <div>
            <h1 style={{color:'white', marginLeft:'140px'}}>hello world</h1>
        </div>
    )
}
export default Sidebar;

【问题讨论】:

    标签: reactjs react-hooks jsx


    【解决方案1】:

    在父容器div 上使用下面的 Css 包装您的代码:

    display: flex;
    flex-direction: row;
    

    链接:Demo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-22
      • 2019-05-09
      相关资源
      最近更新 更多