请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

marginTop 失效问题

老师您好,在 5-3 节中,我将 marginTop 设置为 10px 之后,结果别没有显示 10px 的上边距,如下图所示:
图中没有正确显示上边距
我的代码如下,希望得到老师的解答,谢谢!

import React, { Component } from 'react';
import 'antd/dist/antd.css';
import { Input, Button } from 'antd';

class TodoList extends Component {
    render() {
        return (
          <div style={{marginTop: '10px', marginLeft: '10px'}}>
            <div>
            <Input placeholder="请输入" style={{width: '300px', marginRight: '10px'}} />
            <Button type="primary">提交</Button>
            </div>
          </div>
        )
    }
}

export default TodoList;

正在回答

插入代码

1回答

Dell 2020-08-03 23:19:23

<div style={{marginTop: 10, marginLeft: 10}}> 这么写有用吗

0 回复 有任何疑惑可以回复我~
  • 提问者 weixin_慕仔6041768 #1
    谢谢老师,这样也可以,之前的问题后来重新 npm run start 下就好了,不知道为啥
    回复 有任何疑惑可以回复我~ 2020-08-04 08:56:49
  • Dell 回复 提问者 weixin_慕仔6041768 #2
    很诡异,行,解决就好
    回复 有任何疑惑可以回复我~ 2020-08-06 00:40:14
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号